Function Resource Configuration Method and Device

ABSTRACT

A function resource configuration method and device relate to the field of communications technologies, where the configuration method includes receiving, by a wearable device, a distribution request from a first terminal, where the distribution request requests the wearable device to distribute a first function resource of the wearable device to the first terminal, and the first function resource is already occupied by a second terminal, determining, by the wearable device based on the distribution request, whether to allow the first terminal to use the first function resource, and sending, by the wearable device, a notification message to the first terminal instructing the first terminal to use the first function resource when the wearable device allows the first terminal to use the first function resource.

TECHNICAL FIELD

This application relates to the field of communications technologies,and in particular, to a function resource configuration method anddevice.

BACKGROUND

With development of communications technologies, a wearable device (suchas a Bluetooth wristband, a smartwatch, smart glasses) has increasinglyrich functions, such as a Bluetooth earphone function and a sport andhealth function.

A wearable device having a plurality of functions includes a pluralityof function resources. The wearable device may support a plurality ofterminals to use different function resources in the wearable device.Specifically, if the wearable device distributes a function resource inthe wearable device to a terminal, the terminal may use the functionresource. For example, for a wearable device having the Bluetoothearphone function and the sport and health function, if the wearabledevice is successfully paired with a terminal, and the wearable devicedistributes a sport and health function resource to the terminal, theterminal may use the sport and health function resource.

However, during a period in which the terminal occupies the sport andhealth function resource, regardless of whether the terminal uses thesport and health function resource, another terminal cannot obtain thesport and health function resource.

SUMMARY

This application provides a function resource configuration method anddevice, so as to resolve a problem that during a period in which aterminal occupies a function resource in a wearable device, anotherterminal cannot obtain the function resource.

To achieve the foregoing objective, the following technical solutionsare used in this application.

According to a first aspect, a function resource configuration method isprovided. The method is performed by a wearable device including atleast one function resource. For a first function resource in the atleast one function resource, in a scenario in which the first functionresource is already occupied by a second terminal, after the wearabledevice receives a distribution request that is sent by a first terminaland that is used to request the wearable device to distribute the firstfunction resource to the first terminal, the wearable device determines,based on the distribution request received by the wearable device,whether to allow the first terminal to use the first function resource,and if the wearable device allows the first terminal to use the firstfunction resource, the wearable device sends a notification message tothe first terminal, to instruct the first terminal to use the firstfunction resource.

In the function resource configuration method provided in thisapplication, even if the first function resource is already occupied bythe second terminal, after receiving the distribution request sent bythe first terminal, the wearable device also determines, based on thedistribution request received by the wearable device, whether to allowthe first terminal to use the first function resource. If the wearabledevice allows the first terminal to use the first function resource, thewearable device sends the notification message to the first terminal, toinstruct the first terminal to use the first function resource. In thisway, in a scenario in which the first function resource is alreadyoccupied by the second terminal, the first terminal may also use thefirst function resource.

It is easily understood that in a scenario in which the first functionresource is already occupied by the second terminal but the secondterminal has not used the first function resource for a long time, byusing the function resource configuration method provided in thisapplication, the first terminal can successfully preempt and use thefirst function resource, thereby effectively improving utilization ofthe first function resource.

In this application, that the first function resource is alreadyoccupied by the second terminal means that the wearable device alreadydistributes the first function resource to the second terminal, that is,the second terminal already obtains the first function resource. Itshould be noted that after obtaining the first function resource, thesecond terminal may use the first function resource. However, during aperiod in which the second terminal occupies the first functionresource, the second terminal may not use the first function resource.

Optionally, in a possible implementation of this application, after thewearable device receives the distribution request sent by the firstterminal, the wearable device presents content corresponding to thedistribution request to a user, and receives an instruction entered bythe user. Specifically, a method for determining, by the wearable devicebased on the distribution request, whether to allow the first terminalto use the first function resource includes: if the wearable devicereceives a first instruction entered by the user, allowing, by thewearable device, the first terminal to use the first function resource,where the first instruction is used to instruct to distribute the firstfunction resource to the first terminal; or if the wearable devicereceives a second instruction entered by the user, forbidding, by thewearable device, the first terminal to use the first function resource,where the second instruction is used to indicate that distribution ofthe first function resource to the first terminal is forbidden.

By using the method in which the wearable device displays the contentcorresponding to the distribution request and determines, based on theinstruction entered by the user, whether to allow the first terminal touse the first function resource, interaction between the wearable deviceand the user is implemented, thereby improving user experience.

Optionally, in another possible implementation of this application, amethod for determining, by the wearable device based on the distributionrequest, whether to allow the first terminal to use the first functionresource includes: determining, by the wearable device based on thedistribution request, whether occupation duration is greater than apreset threshold, where the occupation duration is a time in which thesecond terminal occupies the first function resource; and if theoccupation duration is greater than or equal to the preset threshold,allowing, by the wearable device, the first terminal to occupy the firstfunction resource; or if the occupation duration is less than the presetthreshold, forbidding, by the wearable device, the first terminal tooccupy the first function resource.

The method in which the wearable device determines, based on theoccupation duration, whether to allow the first terminal to use thefirst function resource ensures that each terminal can effectively usethe first function resource after occupying the first function resource.

Optionally, in another possible implementation of this application, amethod for determining, by the wearable device based on the distributionrequest, whether to allow the first terminal to use the first functionresource includes: determining, by the wearable device based on thedistribution request, whether a priority of the first terminal is higherthan a priority of the second terminal; and if the priority of the firstterminal is higher than the priority of the second terminal, allowing,by the wearable device, the first terminal to use the first functionresource; or if the priority of the first terminal is lower than thepriority of the second terminal, forbidding, by the wearable device, thefirst terminal to use the first function resource.

The method in which the wearable device determines, based on thepriority of the first terminal and the priority of the second terminal,whether to allow the first terminal to use the first function resourceensures that a terminal having a higher priority preferentially uses thefirst function resource.

It can be learned that according to any of the foregoing methods, thewearable device can determine whether to allow the first terminal to usethe first function resource, and each method has a corresponding effect.It should be noted that in this application, the method for determining,by the wearable device, whether to allow the first terminal to use thefirst function resource may alternatively be a method other than theforegoing methods. This is not specifically limited in this application.

Optionally, in another possible implementation of this application,before the wearable device receives the distribution request sent by thefirst terminal, the wearable device determines that the first functionresource is already occupied by the second terminal. Specifically, amethod for determining, by the wearable device, that the first functionresource is already occupied by the second terminal includes: first,receiving, by the wearable device, a state query request sent by thefirst terminal, where the state query request is used to request toquery a state of the first function resource; and then determining, bythe wearable device based on the state query request, that the firstfunction resource is already occupied by the second terminal.

The state of the first function resource in the wearable device may bethat the first function resource is already occupied by the firstterminal, is not occupied by any terminal, or is already occupied by thesecond terminal. The wearable device may determine a specific state ofthe first function resource based on the state query request sent by thefirst terminal.

Optionally, in another possible implementation of this application,after the determining, by the wearable device, that the first functionresource is already occupied by the second terminal, the wearable devicesends a state query response carrying a first state identifier to thefirst terminal, where the first state identifier is used to indicatethat the first function resource is already occupied by the secondterminal.

Optionally, in another possible implementation of this application,after the receiving, by the wearable device, a state query request sentby the first terminal, the wearable device determines, based on thestate query request, that the first function resource is not occupied byany terminal, and sends a state query response carrying a second stateidentifier to the first terminal, where the second state identifier isused to indicate that the first function resource is not occupied by anyterminal.

Optionally. in another possible implementation of this application,after the receiving, by the wearable device, a state query request sentby the first terminal, the wearable device determines, based on thestate query request, that the first function resource is alreadyoccupied by the first terminal, and sends a state query responsecarrying a third state identifier to the first terminal, where the thirdstate identifier is used to indicate that the first function resource isalready occupied by the first terminal.

Regardless of which state the first function resource is specificallyin, after the wearable device determines, based on the state queryrequest, the state of the first function resource, the wearable devicesends a state query response carrying a state identifier correspondingto the state of the first function resource to the first terminal. Inthis way, the first terminal may learn about the state of the firstfunction resource based on the state identifier, so that the firstterminal determines, based on the state of the first function resource,whether the first function resource can be directly used.

Optionally, in another possible implementation of this application,after the wearable device receives the distribution request sent by thefirst terminal, and before the determining, by the wearable device basedon the distribution request, whether to allow the first terminal to usethe first function resource, the wearable device may further determine,based on the distribution request, that the first function resource isalready occupied by the second terminal.

In this application scenario, the wearable device may directlydetermine, based on the distribution request, that the first functionresource is already occupied by the second terminal device, anddetermine, based on the distribution request, whether to allow the firstterminal to use the first function resource. Compared with the foregoingapplication scenario in which the wearable device determines, based onthe state query request, that the first function resource is alreadyoccupied by the second terminal device, in this application scenario,information exchange between the wearable device and the first terminalis reduced, thereby reducing a waste of resources.

Optionally, in another possible implementation of this application,after the wearable device receives the distribution request sent by thefirst terminal, the wearable device may further determine, based on thedistribution request, that the first function resource is not occupiedby any terminal, and determine, based on the distribution request,whether to allow the first terminal to use the first function resource,and if the wearable device allows the first terminal to use the firstfunction resource, the wearable device sends a notification message tothe first terminal.

Optionally, in another possible implementation of this application,after the wearable device receives the distribution request sent by thefirst terminal, the wearable device may further determine, based on thedistribution request, that the first function resource is alreadyoccupied by the first terminal, and send the notification to the firstterminal, to instruct the first terminal to use the first functionresource.

It can be learned that the wearable device may directly determine thestate of the first function resource based on the distribution request,and when allowing the first terminal to use the first function resource,the wearable device sends the notification message to the firstterminal. In this way, regardless of which state the first functionresource is specifically in, provided that the wearable device allowsthe first terminal to use the first function resource, the firstterminal may receive the notification message sent by the wearabledevice, so as to use the first function resource.

Specifically, the state query request sent by the first terminal to thewearable device carries an identifier of the first terminal and anidentifier of the first function resource. In a scenario in which thefirst terminal sends the state query request to the wearable devicefirst, and then sends the distribution request to the wearable device,the distribution request carries the identifier of the first functionresource, and may further carry the identifier of the first terminal. Ina scenario in which the first terminal sends no state query request tothe wearable device, the distribution request sent by the first terminalcarries the identifier of the first function resource and the identifierof the first terminal.

Optionally, in another possible implementation of this application,before the wearable device determines the state of the first functionresource, the wearable device further needs to determine whether thewearable device includes the first function resource.

Optionally, in another possible implementation of this application, amethod for determining, by the wearable device, whether the wearabledevice includes the first function resource includes: detecting, by thewearable device, whether a function resource list includes theidentifier of the first function resource, where the function resourcelist stores an identifier of a function resource included in thewearable device; and if the function resource list stores the identifierof the first function resource, determining, by the wearable device,that the wearable device includes the first function resource; or if thefunction resource list does not store the identifier of the firstfunction resource, determining, by the wearable device, that thewearable device does not include the first function resource.

The function resource list in this application may be indicated by usinga table, or may be indicated in another form. This is not specificallylimited in this application.

It is easily understood that in this application, after beingsuccessfully paired with the wearable device, the first terminal maycommunicate with the wearable device first, to obtain the identifier ofthe function resource included in the wearable device. In this scenario,after receiving the request sent by the first terminal, the wearabledevice does not need to detect whether the wearable device includes thefirst function resource. In addition, in this application, after beingsuccessfully paired with the wearable device, the first terminal mayfurther directly send a request carrying the identifier of the firstfunction resource to the wearable device. In this scenario, the wearabledevice may not include the first function resource. Therefore, afterreceiving the request, the wearable device needs to detect whether thewearable device includes the first function resource.

Optionally, in another possible implementation of this application, thewearable device determines the state of the first function resourcebased on the identifier of the first function resource. Specifically, amethod for determining, by the wearable device, the state of the firstfunction resource based on the identifier of the first function resourceincludes: detecting, by the wearable device, whether a function resourceoccupation list includes the identifier of the first function resource,where the function resource occupation list stores a correspondencebetween an identifier of a function resource that is already occupiedand an identifier of a terminal that occupies the function resource; ifthe function resource occupation list includes the identifier of thefirst function resource, detecting, by the wearable device, whether anidentifier of a terminal corresponding to the identifier of the firstfunction resource in the function resource occupation list is the sameas the identifier of the first terminal; if yes, determining that thestate of the first function resource is that the first function resourceis already occupied by the first terminal; or info, determining that thestate of the first function resource is that the first function resourceis already occupied by another terminal; and if the function resourceoccupation list does not include the identifier of the first functionresource, determining that the state of the first function resource isthat the first function resource is not occupied by any terminal.

The function resource occupation list in this application may beindicated by using a table, or may be indicated in another form. This isnot specifically limited in this application.

According to a second aspect, a function resource configuration methodis provided. The method is performed by a first terminal thatcommunicates with a wearable device, and the wearable device includes atleast one function resource. For a first function resource in the atleast one function resource, after the first terminal determines thatthe first function resource is already occupied by a second terminal,the first terminal sends a distribution request to the wearable deviceto request the wearable device to distribute the first function resourceto the first terminal. Correspondingly, the first terminal may receive anotification message sent by the wearable device, where the notificationmessage is used to instruct the first terminal to use the first functionresource.

In the function resource configuration method provided in thisapplication, even if the first terminal determines that the firstfunction resource is already occupied by the second terminal, the firstterminal may still send a function resource distribution request to thewearable device to request the wearable device to distribute the firstfunction resource to the first terminal. In this way, the wearabledevice may determine, based on the function resource distributionrequest, whether to allow the first terminal to occupy the firstfunction resource. If the wearable device determines that the firstterminal is allowed to use the first function resource, the firstterminal receives the notification message sent by the wearable device.In this way, in a scenario in which the first function resource isalready occupied by the second terminal, the first terminal may also usethe first function resource based on the notification message.

It is easily understood that in a scenario in which the first functionresource is already occupied by the second terminal but the secondterminal has not used the first function resource for a long time, byusing the function resource configuration method provided in thisapplication, the first terminal can successfully preempt and use thefirst function resource, thereby effectively improving utilization ofthe first function resource.

Optionally, in a possible implementation of this application, beforedetermining that the first function resource in the wearable device isalready occupied by the second terminal, the first terminal sends astate query request to the wearable device, where the state queryrequest is used to request to obtain a state of the first functionresource.

In this application, the first terminal determines, by requesting toobtain the state of the first function resource from the wearabledevice, whether the first function resource can be directly used.

Optionally, in another possible implementation of this application, amethod for determining, by the first terminal, that the first functionresource in the wearable device is already occupied by the secondterminal includes: receiving, by the first terminal, a state queryresponse that carries a first state identifier and that is sent by thewearable device, where the first state identifier is used to indicatethat the first function resource is already occupied by the secondterminal; and determining, by the first terminal based on the firststate identifier, that the first function resource is already occupiedby the second terminal.

Optionally, in another possible implementation of this application,after the first terminal determines that the first function resource inthe wearable device is already occupied by the second terminal, theconfiguration method further includes: presenting, by the firstterminal, content corresponding to the state query response to a user;and receiving, by the first terminal, a third instruction entered by theuser, where the third instruction is used to instruct to request thewearable device to distribute the first function resource to the firstterminal.

In this application, the first terminal implements interaction with theuser by presenting the content corresponding to the state query responseto the user, to help the user determine, based on an actual requirementof the user, whether the first terminal needs to use the first functionresource, thereby resolving a problem that the user cannot learn thatthe terminal cannot use a function corresponding to the first functionresource, and improving user experience to some extent. In addition,this implementation relatively better conforms with an actualapplication.

Optionally, in another possible implementation of this application,after the sending, by the first terminal, a state query request to thewearable device, the first terminal receives a state query response thatcarries a second state identifier and that is sent by the wearabledevice, where the second state identifier is used to indicate that thefirst function resource is not occupied by any terminal.

Optionally, in another possible implementation of this application,after the sending, by the first terminal, a state query request to thewearable device, the first terminal receives a state query response thatcarries a third state identifier and that is sent by the wearabledevice, where the third state identifier is used to indicate that thefirst function resource is already occupied by the first terminal; andthe first terminal uses the first function resource based on the thirdstate identifier.

The first function resource may be in a state in which the firstfunction resource is already occupied by the first terminal, is alreadyoccupied by the second terminal, or is not occupied by any terminal.When the first terminal requests to obtain the state of the firstfunction resource from the wearable device, regardless of which statethe first function resource is specifically in, the wearable devicesends a state query response carrying a state identifier correspondingto the state of the first function resource to the first terminal. Inthis way, the first terminal may learn about the state of the firstfunction resource based on the state identifier, so that the firstterminal determines, based on the state of the first function resource,whether the first function resource can be directly used.

According to a third aspect, a wearable device is provided. The wearabledevice includes a receiving unit, a determining unit, and a sendingunit.

Functions implemented by the unit modules provided in this applicationare specifically as follows:

The receiving unit is configured to receive a distribution request sentby a first terminal, where the distribution request is used to requestthe wearable device to distribute a first function resource of thewearable device to the first terminal, and the first function resourceis already occupied by a second terminal; the determining unit isconfigured to determine, based on the distribution request received bythe receiving unit, whether to allow the first terminal to use the firstfunction resource; and the sending unit is configured to: if thedetermining unit allows the first terminal to use the first functionresource, send a notification message to the first terminal, to instructthe first terminal to use the first function resource.

Further, in a possible implementation of this application, the wearabledevice further includes a display unit, where the display unit isconfigured to: after the receiving unit receives the distributionrequest sent by the first terminal, present content corresponding to thedistribution request to a user; the receiving unit is further configuredto: after the display unit presents the content corresponding to thedistribution request to the user, receive an instruction entered by theuser; and the determining unit is specifically configured to: if thereceiving unit receives a first instruction entered by the user, allowthe first terminal to use the first function resource, where the firstinstruction is used to instruct to distribute the first functionresource to the first terminal, and is specifically configured to: ifthe receiving unit receives a second instruction entered by the user,forbid the first terminal to use the first function resource, where thesecond instruction is used to indicate that distribution of the firstfunction resource to the first terminal is forbidden.

Further, in another possible implementation of this application, thewearable device further includes a judgment unit, where the judgmentunit is configured to determine, based on the distribution requestreceived by the receiving unit, whether occupation duration is greaterthan a preset threshold, where the occupation duration is a time inwhich the second terminal occupies the first function resource; and thedetermining unit is specifically configured to: if the judgment unitdetermines that the occupation duration is greater than or equal to thepreset threshold, allow the first terminal to use the first functionresource, and is specifically configured to: if the judgment unitdetermines that the occupation duration is less than the presetthreshold, forbid the first terminal to use the first function resource.

Further, in another possible implementation of this application, thewearable device further includes a judgment unit, where the judgmentunit is configured to determine, based on the distribution requestreceived by the receiving unit, whether a priority of the first terminalis higher than a priority of the second terminal; and the determiningunit is specifically configured to: if the judgment unit determines thatthe priority of the first terminal is higher than the priority of thesecond terminal, allow the first terminal to use the first functionresource, and is specifically configured to: if the judgment unitdetermines that the priority of the first terminal is lower than thepriority of the second terminal, forbid the first terminal to use thefirst function resource.

Further, in another possible implementation of this application, thereceiving unit is further configured to: before receiving thedistribution request sent by the first terminal, receive a state queryrequest sent by the first terminal, where the state query request isused to request to query a state of the first function resource; and thedetermining unit is further configured to determine, based on the statequery request received by the receiving unit, that the first functionresource is already occupied by the second terminal.

Further, in another possible implementation of this application, thesending unit is further configured to: after the determining unitdetermines that the first function resource is already occupied by thesecond terminal, send a state query response carrying a first stateidentifier to the first terminal, where the first state identifier isused to indicate that the first function resource is already occupied bythe second terminal.

Further, in another possible implementation of this application, thedetermining unit is further configured to: after the receiving unitreceives the state query request sent by the first terminal, determine,based on the state query request, that the first function resource isnot occupied by any terminal; and the sending unit is further configuredto: send a state query response carrying a third state identifier to thefirst terminal, where the second state identifier is used to indicatethat the first function resource is not occupied by any terminal.

Further, in another possible implementation of this application, thedetermining unit is further configured to: after the receiving unitreceives the state query request sent by the first terminal, determine,based on the state query request, that the first function resource isalready occupied by the first terminal; and the sending unit is furtherconfigured to: send a state query response carrying a third stateidentifier to the first terminal, where the third state identifier isused to indicate that the first function resource is already occupied bythe first terminal.

Further, in another possible implementation of this application, thedetermining unit is further configured to: after the receiving unitreceives the distribution request sent by the first terminal, and beforedetermining, based on the distribution request, whether to allow thefirst terminal to use the first function resource, determine, based onthe distribution request, that the first function resource is alreadyoccupied by the second terminal.

According to a fourth aspect, a wearable device is provided. Thewearable device includes a processor, a memory, and a communicationsinterface. The processor is configured to: receive, by using thecommunications interface, a distribution request sent by a firstterminal, where the distribution request is used to request the wearabledevice to distribute a first function resource stored in the memory tothe first terminal, and the first function resource is already occupiedby a second terminal; determine, based on the distribution request,whether to allow the first terminal to use the first function resource;and if the first terminal is allowed to use the first function resource,send a notification message to the first terminal by using thecommunications interface, to instruct the first terminal to use thefirst function resource.

Further, in a possible implementation of this application, the wearabledevice further includes a display screen, where the display screen isconfigured to: after the processor receives, by using the communicationsinterface, the distribution request sent by the first terminal, presentcontent corresponding to the distribution request to a user, and receivean instruction entered by the user; and the processor is specificallyconfigured to: if the display screen receives a first instructionentered by the user, allow the first terminal to use the first functionresource, where the first instruction is used to instruct to distributethe first function resource to the first terminal, and is specificallyconfigured to: if the display screen receives a second instructionentered by the user, forbid the first terminal to use the first functionresource, where the second instruction is used to indicate thatdistribution of the first function resource to the first terminal isforbidden.

Further, in another possible implementation of this application, theprocessor is specifically configured to: determine, based on thedistribution request, whether occupation duration is greater than apreset threshold, where the occupation duration is a time in which thesecond terminal occupies the first function resource; and if theoccupation duration is greater than or equal to the preset threshold,allow the first terminal to use the first function resource; or if theoccupation duration is less than the preset threshold, forbid the firstterminal to use the first function resource.

Further, in another possible implementation of this application, theprocessor is specifically configured to: determine, based on thedistribution request, whether a priority of the first terminal is higherthan a priority of the second terminal; and if the priority of the firstterminal is higher than the priority of the second terminal, allow thefirst terminal to use the first function resource; or if the priority ofthe first terminal is lower than the priority of the second terminal,forbid the first terminal to use the first function resource.

Further, in another possible implementation of this application, beforereceiving, by using the communications interface, the distributionrequest sent by the first terminal, the processor is further configuredto: receive, by using the communications interface, a state queryrequest sent by the first terminal, where the state query request isused to request to query a state of the first function resource; anddetermine, based on the state query request, that the first functionresource is already occupied by the second terminal.

Further, in another possible implementation of this application, afterdetermining that the first function resource is already occupied by thesecond terminal, the processor is further configured to: send, by usingthe communications interface, a state query response carrying a firststate identifier to the first terminal, where the first state identifieris used to indicate that the first function resource is already occupiedby the second terminal.

Further, in another possible implementation of this application, afterreceiving, by using the communications interface, the state queryrequest sent by the first terminal, the processor is further configuredto: determine, based on the state query request, that the first functionresource is not occupied by any terminal; and send, by using thecommunications interface, a state query response carrying a second stateidentifier to the first terminal, where the second state identifier isused to indicate that the first function resource is not occupied by anyterminal.

Further, in another possible implementation of this application, afterreceiving, by using the communications interface, the state queryrequest sent by the first terminal, the processor is further configuredto: determine, based on the state query request, that the first functionresource is already occupied by the first terminal; and send, by usingthe communications interface, a state query response carrying a thirdstate identifier to the first terminal, where the third state identifieris used to indicate that the first function resource is already occupiedby the first terminal.

Further, in another possible implementation of this application, theprocessor is further configured to: after receiving, by using thecommunications interface, the distribution request sent by the firstterminal, and before determining, based on the distribution request,whether to allow the first terminal to use the first function resource,determine, based on the distribution request, that the first functionresource is already occupied by the second terminal.

According to a fifth aspect, a computer-readable storage medium isfurther provided. The computer-readable storage medium includes one ormore pieces of program code, and when a processor of a wearable deviceexecutes the program code, the wearable device performs the functionresource configuration method according to the first aspect and variouspossible implementations thereof.

In this application, a name of the wearable device does not limitdevices or functional modules. In actual implementation, the devices orthe functional modules may be named after another name. Provided thatfunctions of the devices or the functional modules are similar to thosein this application, the devices or the functional modules belong to thescope of the claims of this application and their equivalenttechnologies.

For specific descriptions of the third aspect, the fourth aspect, thefifth aspect, and various implementations thereof in this application,refer to detailed descriptions in the first aspect and the variousimplementations thereof; and for beneficial effects of the third aspect,the fourth aspect, the fifth aspect, and the various implementationsthereof, refer to beneficial effect analysis in the first aspect and thevarious implementations thereof, and details are not described hereinagain.

According to a sixth aspect, a terminal is provided. The terminalincludes a determining unit, a sending unit, and a receiving unit.

Functions implemented by the unit modules provided in this applicationare specifically as follows:

The determining unit is configured to determine that a first functionresource in a wearable device is already occupied by a second terminal;the sending unit is configured to send a distribution request to thewearable device, where the distribution request is used to request thewearable device to distribute the first function resource to the firstterminal; and the receiving unit is configured to receive a notificationmessage sent by the wearable device, where the notification message isused to instruct the first terminal to use the first function resource.

Further, in a possible implementation of this application, the sendingunit is further configured to: before the determining unit determinesthat the first function resource in the wearable device is alreadyoccupied by the second terminal, send a state query request to thewearable device, where the state query request is used to request toobtain a state of the first function resource.

Further, in another possible implementation of this application, thereceiving unit is further configured to receive a state query responsethat carries a first state identifier and that is sent by the wearabledevice, where the first state identifier is used to indicate that thefirst function resource is already occupied by the second terminal; andthe determining unit is specifically configured to determine, based onthe first state identifier in the state query response that is receivedby the receiving unit, that the first function resource is alreadyoccupied by the second terminal.

Further, in another possible implementation of this application, theterminal further includes a display unit, where the display unit isconfigured to: after the determining unit determines that the firstfunction resource in the wearable device is already occupied by thesecond terminal, present content corresponding to the state queryresponse to a user; and the receiving unit is further configured toreceive a third instruction entered by the user, where the thirdinstruction is used to instruct to request the wearable device todistribute the first function resource to the first terminal.

Further, in another possible implementation of this application, thereceiving unit is further configured to: after the sending unit sendsthe state query request to the wearable device, receive a state queryresponse that carries a second state identifier and that is sent by thewearable device, where the second state identifier is used to indicatethat the first function resource is not occupied by any terminal.

Further, in another possible implementation of this application, thereceiving unit is further configured to: after the sending unit sendsthe state query request to the wearable device, receive a state queryresponse that carries a third state identifier and that is sent by thewearable device, where the third state identifier is used to indicatethat the first function resource is already occupied by the firstterminal; and the terminal further includes a function implementationunit, where the function implementation unit is configured to use thefirst function resource based on the third state identifier carried inthe state query response received by the receiving unit.

According to a seventh aspect, a terminal is provided. The terminalincludes a processor and a communications interface. Specifically, theprocessor is configured to: determine that a first function resource ina wearable device is already occupied by another terminal; send adistribution request to the wearable device by using the communicationsinterface, where the distribution request is used to request thewearable device to distribute the first function resource to theterminal; and receive, by using the communications interface, anotification message sent by the wearable device, where the notificationmessage is used to instruct the first terminal to use the first functionresource.

Further, in a possible implementation of this application, the processoris further configured to: before determining that the first functionresource in the wearable device is already occupied by the anotherterminal, send a state query request to the wearable device by using thecommunications interface, where the state query request is used torequest to obtain a state of the first function resource.

Further, in another possible implementation of this application, theprocessor is specifically configured to: receive, by using thecommunications interface, a state query response that carries a firststate identifier and that is sent by the wearable device, where thefirst state identifier is used to indicate that the first functionresource is already occupied by the another terminal; and determine,based on the first state identifier, that the first function resource isalready occupied by the another terminal.

Further, in another possible implementation of this application, theterminal further includes a display screen, where the display screen isconfigured to: after the processor determines that the first functionresource in the wearable device is already occupied by a secondterminal, present content corresponding to the state query response to auser; and receive a third instruction entered by the user, where thethird instruction is used to instruct to request the wearable device todistribute the first function resource to the terminal.

Further, in another possible implementation of this application, theprocessor is further configured to: after sending the state queryrequest to the wearable device by using the communications interface,receive, by using the communications interface, a state query responsethat carries a second state identifier and that is sent by the wearabledevice, where the second state identifier is used to indicate that thefirst function resource is not occupied by any terminal.

Further, in another possible implementation of this application, theprocessor is further configured to: after sending the state queryrequest to the wearable device by using the communications interface,receive, by using the communications interface, a state query responsethat carries a third state identifier and that is sent by the wearabledevice, where the third state identifier is used to indicate that thefirst function resource is already occupied by the terminal; and use thefirst function resource based on the third state identifier.

According to an eighth aspect, a computer-readable storage medium isfurther provided. The computer-readable storage medium includes one ormore pieces of program code, and when a processor of a terminal executesthe program code, the terminal performs the function resourceconfiguration method according to the second aspect and various possibleimplementations thereof.

In this application, a name of the terminal does not limit devices orfunctional modules. In actual implementation, the devices or thefunctional modules may be named after another name. Provided thatfunctions of the devices or the functional modules are similar to thosein this application, the devices or the functional modules belong to thescope of the claims of this application and their equivalenttechnologies.

For specific descriptions of the sixth aspect, the seventh aspect, theeighth aspect, and various implementations thereof in this application,refer to detailed descriptions in the second aspect and the variousimplementations thereof; and for beneficial effects of the sixth aspect,the seventh aspect, the eighth aspect, and the various implementationsthereof, refer to beneficial effect analysis in the second aspect andthe various implementations thereof, and details are not describedherein again.

Optionally, in the foregoing aspects and various implementations of eachaspect, the first function resource in this application is a resourcewith a user attribute or a resource without a user attribute. A resourcewith a user attribute may be construed as a function resource that needsto obtain and/or store related data corresponding to a user duringrunning. For example, during running, a function resource used toimplement a function of detecting blood pressure of a user needs toobtain and/or store data indicating the blood pressure of the user.Correspondingly, a resource without a user attribute may be construed asa function resource that does not need to obtain and/or store relateddata corresponding to a user during running, for example, a Bluetoothearphone function resource and a music play function resource. TheBluetooth earphone function resource is only used to implement a callfunction of a user, and does not need to store related data. The musicplay function resource is only used to implement a function of playingmusic for a terminal, and does not need to store related data of a user.

Optionally, in the foregoing aspects and the various implementations ofeach aspect, the state query request sent by the first terminal to thewearable device carries the identifier of the first terminal and theidentifier of the first function resource. In a scenario in which thefirst terminal sends the state query request to the wearable devicefirst, and then sends the distribution request to the wearable device,the distribution request carries the identifier of the first functionresource, and may further carry the identifier of the first terminal. Ina scenario in which the first terminal sends no state query request tothe wearable device, the distribution request sent by the first terminalcarries the identifier of the first function resource and the identifierof the first terminal.

It is clearer and easier to understand these aspects or other aspects ofthis application in the following descriptions.

BRIEF DESCRIPTION OF DRAWINGS

To describe the technical solutions in the embodiments of thisapplication more clearly, the following briefly describes theaccompanying drawings required for describing the embodiments.Apparently, the accompanying drawings in the following description showmerely some embodiments of this application.

FIG. 1 is a schematic structural diagram of a communications systemaccording to an embodiment of this application;

FIG. 2 is a schematic diagram of interactive collaboration betweendevices in a communications system according to an embodiment of thisapplication;

FIG. 3A and FIG. 3B are a first schematic flowchart of a functionresource configuration method according to an embodiment of thisapplication;

FIG. 4A and FIG. 4B are a second schematic flowchart of a functionresource configuration method according to an embodiment of thisapplication;

FIG. 5 is an interaction interface 1 displayed by a smartphone 1according to an embodiment of this application;

FIG. 6 is an interaction interface 2 displayed by a smartphone 1according to an embodiment of this application;

FIG. 7 is an interaction interface 3 displayed by a smartphone 1according to an embodiment of this application:

FIG. 8 is an interaction interface 4 displayed by a smartphone 1according to an embodiment of this application;

FIG. 9 is an interaction interface 1 displayed by a wearable deviceaccording to an embodiment of this application;

FIG. 10 is an interaction interface 5 displayed by a smartphone 1according to an embodiment of this application;

FIG. 11 is an interaction interface displayed by a smartphone 2according to an embodiment of this application;

FIG. 12 is an interaction interface 2 displayed by a wearable deviceaccording to an embodiment of this application;

FIG. 13A and FIG. 13B are interaction interfaces displayed by differentdevices by using interactive collaboration according to an embodiment ofthis application;

FIG. 14 is a third schematic flowchart of a function resourceconfiguration method according to an embodiment of this application;

FIG. 15 is a first schematic structural diagram of a wearable deviceaccording to an embodiment of this application:

FIG. 16 is a second schematic structural diagram of a wearable deviceaccording to an embodiment of this application;

FIG. 17 is a third schematic structural diagram of a wearable deviceaccording to an embodiment of this application;

FIG. 18 is a first schematic structural diagram of a terminal accordingto an embodiment of this application:

FIG. 19 is a second schematic structural diagram of a terminal accordingto an embodiment of this application; and

FIG. 20 is a third schematic structural diagram of a terminal accordingto an embodiment of this application.

DESCRIPTION OF EMBODIMENTS

The following describes in detail the technical solutions in theembodiments of this application with reference to the accompanyingdrawings in the embodiments of this application. Apparently, thedescribed embodiments are merely some but not all of the embodiments ofthis application.

In the specification, claims, and accompanying drawings of thisapplication, the terms “first”, “second”, and so on are intended todistinguish between different objects but do not limit a particularorder. In addition, the terms “including”, “comprising”, or any othervariant thereof, are intended to cover a non-exclusive inclusion. Forexample, a process, a method, a system, a product, or a device thatincludes a series of steps or units is not limited to the listed stepsor units, but optionally further includes an unlisted step or unit, oroptionally further includes another inherent step or unit of theprocess, the method, the product, or the device.

In the following description, to illustrate rather than limit, specificdetails such as a particular system structure, an interface, and atechnology are provided to make a thorough understanding of thisapplication. However, a person skilled in the art should know that thisapplication may be implemented in other embodiments without thesespecific details. In other cases, detailed descriptions of well-knownmobile devices, circuits, and methods are omitted, so that thisapplication is described without being obscured by unnecessary details.

In addition, the term “and/or” in this specification describes only anassociation relationship for describing associated objects andrepresents that three relationships may exist. For example, A and/or Bmay represent the following three cases; Only A exists, both A and Bexist, and only B exists. In addition, the character “/” in thisspecification generally indicates an “or” relationship between theassociated objects.

A function resource in a wearable device may be understood as a service(English: service) of the wearable device, for example, detecting aheart rate of a user. Each function resource in the wearable device mayhave an identifier that can uniquely indicate the function resource.

Optionally, the identifier of the function resource may be a UUID(Universally Unique Identifier, universal unique identifier), or may beanother identifier that can uniquely indicate the function resource.This is not specifically limited in this embodiment of this application.

In the prior art, when a wearable device including a plurality offunction resources communicates with a terminal, if a terminal A alreadyoccupies a function resource a of the wearable device, a terminal B mayfail to detect that the wearable device includes the function resourcea; and consequently, the terminal B cannot use the function resource aof the wearable device. Alternatively, the terminal B may detect thatthe wearable device includes the function resource a; however, after theterminal B requests the wearable device to distribute the functionresource a to the terminal B, the terminal B can receive only a responsemessage that is sent by the wearable device and that is used to notifythe terminal B that the function resource a cannot be used; andconsequently, the terminal B still cannot use the function resource a ofthe wearable device. Because the terminal B cannot use the functionresource a of the wearable device, the terminal B cannot implement afunction corresponding to the function resource a. For a user to whomthe terminal B belongs, the user does not know why the function cannotbe used. Consequently, user experience is reduced to some extent.

For the prior-art problem that during a period in which the terminal Aoccupies the function resource a of the wearable device, the terminal Bcannot obtain the function resource a, an embodiment of this applicationprovides a function resource configuration method. When determining thata first function resource is already occupied by a second terminal and afirst terminal is allowed to use the first function resource, a wearabledevice sends a notification message used to instruct the first terminalto use the first function resource to the first terminal, so that thefirst terminal uses the first function resource based on thenotification message, thereby implementing a corresponding function.

The function resource configuration method provided in this embodimentof this application is applied to a communications system. FIG. 1 is aschematic structural diagram of a communications system according to anembodiment of this application. Referring to FIG. 1, the communicationssystem includes a wearable device 10 and at least two terminals 11, andeach terminal 11 is wirelessly connected to the wearable device 10.

A connection manner between each terminal 11 and the wearable device 10may be any one of wireless short-range communications technologies suchas BT (Bluetooth, Bluetooth), Wi-Fi (Wireless-Fidelity, WirelessFidelity), NFC (Near Field Communication, near field communication), andinfrared (English: Infrared). This is not specifically limited in thisembodiment of this application.

The wearable device 10 includes but is not limited to various smartwearable devices such as a smartwatch, a smartband, a smart wrist strap,smart glasses, a smart necklace, a smart ring, smart earrings, and asmartphone. In an actual application, the wearable device 10 may providevarious available network connection capabilities such as BT, Wi-Fi,NFC, and infrared. Various sensors such as an accelerometer, agyroscope, a magnetometer, a light sensor, a GPS (Global PositioningSystem, Global Positioning System) and I/O (Input/Output, input/output)components such as a microphone and a speaker may be built in thewearable device 10. The wearable device 10 may effectively detect amovement (such as running or walking) of a user, sign data (such as aheart rate or blood pressure) of the user, and a place at which the useris currently located (that is, a location at which the user is currentlylocated), and the like by using the foregoing various sensors.

The wearable device 10 includes a plurality of functions such as theforegoing functions of detecting walking of the user and detecting theheart rate of the user. Correspondingly, the wearable device 10 includesa plurality of function resources.

The terminal 11 is a wireless terminal that can provide variousavailable network connection capabilities such as BT, Wi-Fi, NFC, andinfrared. The wireless terminal may be a device that provides a userwith voice and/or data connectivity, a handheld device with a wirelessconnection function, or another processing device connected to awireless modem. The wireless terminal may communicate with one or morecore networks by using a radio access network (such as RAN, Radio AccessNetwork). The wireless terminal may be a mobile terminal such as amobile phone (also referred to as a “cellular” phone) or a computerincluding a mobile terminal, or may be a portable, pocket-sized,handheld, computer built-in, or in-vehicle mobile apparatus. Thewireless terminal exchanges voice and/or data with the radio accessnetwork. For example, the wireless terminal may be a device such as aPCS (Personal Communication Service, personal communication service)phone, a cordless telephone set, a Session Initiation Protocol (SIP)phone, a WLL (Wireless Local Loop, wireless local loop) station, or aPDA (Personal Digital Assistant, personal digital assistant). Thewireless terminal may also be referred to as a user agent (User Agent),a user device (User Device), or UE (User Equipment, user equipment).

After the terminal 11 establishes a connection to the wearable device10, the terminal 11 may use a function resource in the wearable device10, thereby implementing a corresponding function.

It should be noted that, that the terminal 11 uses a function resourcein the wearable device 10 is essentially that client software of theterminal 11 uses the function resource. For ease of description, thatthe terminal uses the function resource is uniformly described in thisembodiment of this application.

With reference to FIG. 1, FIG. 2 is a schematic diagram of interactivecollaboration between the wearable device 10 and the terminal 11 in thecommunications system. Processes of communication between the terminals11 and the wearable device 10 in the communications system are the same.For brevity, FIG. 2 shows only the communication between one of theterminals 11 and the wearable device 10.

Referring to FIG. 2, the wearable device 10 in the communications systemincludes a function resource list 100. The function resource list 100stores identifiers of all function resources included in the wearabledevice 10. Further, the function resource list 100 further stores allthe function resources included in the wearable device 10, and eachfunction resource uniquely corresponds to an identifier of a functionresource.

The function resource list 100 may be stored in the wearable device 10in a form of a table.

For example, if the function resources in the wearable device 10 includedetecting blood pressure of a user, detecting walking of the user,detecting a heart rate of the user, and other function resources, wherean identifier of the function resource for detecting the blood pressureof the user is 1001, an identifier of the function resource fordetecting walking of the user is 1002, an identifier of the functionresource for detecting the heart rate of the user is 1003, and each ofthe other function resources uniquely corresponds to an identifier ofthe function resource, a format of the function resource list 100 in thewearable device 10 may be an example of Table 100 in FIG. 2.

Optionally, the wearable device 10 may further include a functionresource occupation list 101. The function resource occupation list 101stores a correspondence between an identifier of a function resourcethat is already occupied and an identifier of a terminal that occupiesthe function resource.

For example, with reference to Table 1, if a terminal A occupies thefunction resource for detecting the heart rate of the user, a terminal Boccupies the function resource for detecting the blood pressure of theuser, and a terminal D occupies the function resource for detectingwalking of the user, the function resource occupation list may be shownin Table 101 in FIG. 2.

Optionally. Table 100 and Table 101 may store all the function resourcesand function resource occupation information in a form of a table.

It should be noted that Table 100 and Table 101 show only examples ofstorage forms of the function resource identifier, a function resourceidentifier occupation status, and the like in the wearable device 10 intable forms, and are not intended to limit a storage form of thecorrespondence between the identifier of the function resource that isalready occupied and the identifier of the terminal that occupies thefunction resource in the wearable device 10. Certainly, the storage formof the correspondence between the identifier of the function resourcethat is already occupied and the identifier of the terminal thatoccupies the function resource in the wearable device 10 mayalternatively be another storage form. This is not limited in thisembodiment of this application.

The wearable device 10 may determine, based on the function resourceoccupation list 101, whether a function resource is already occupied bya terminal. For example, the function resource occupation list 101 shownin Table 101 includes the identifier 1001 of the function resource, andan identifier of a terminal corresponding to 1001 is A, so that thewearable device can determine that the function resource whoseidentifier is 1001 is already occupied by the terminal A. If anidentifier of a corresponding function resource is not found in Table101, or an identifier of a terminal corresponding to a found identifierof a function resource is null or other invalid information, it may bedetermined that the function resource is not occupied or used by anyterminal.

Specifically, the wearable device 10 further includes a communicationsinterface 102, a processor 103, and a memory 104.

The communications interface 102 is configured to communicate with anexternal device wirelessly connected to the wearable device 10. Thememory 104 is configured to store the function resource list 100 and thefunction resource occupation list 101, and may also be configured tostore a software program and an application module. The processor 103 isconfigured to run or execute the software program and the applicationmodule that are stored in the memory 104, so as to perform variousfunctions of the wearable device 10.

Optionally, the wearable device 10 further includes a display screen105. The display screen 105 is configured to implement interactionbetween the user and the wearable device 10.

After establishing a connection to the wearable device 10, the terminal11 in the communications system communicates with the wearable device10, so that the terminal 11 uses a function resource in the wearabledevice 10, thereby implementing a corresponding function.

Specifically, the terminal 11 includes a communications interface 110, aprocessor 111, a memory 112, and a display screen 113.

The communications interface 110 is configured to communicate with thewearable device 10 connected to the terminal 11. The memory 112 may beconfigured to store a software program and an application module. Theprocessor 111 is configured to run or execute the software program andthe application module that are stored in the memory 112, so as toperform various functions of the terminal 11. The display screen 113 isconfigured to implement interaction between the user and the terminal11.

In this embodiment of this application, an example in which the terminaland the wearable device including the display screen are in a Bluetoothconnection is used for detailed description. In this embodiment of thisapplication, the terminal may occupy and use a plurality of functionresources in the wearable device. Each terminal may request the wearabledevice to distribute a function resource to the terminal. For ease ofunderstanding, in this embodiment of this application, an example inwhich a first terminal requests the wearable device to distribute afirst function resource to the first terminal is used for description.The first function resource may be used to implement functions such asdetecting a movement (such as running or walking) of a user, sign data(such as a heart rate or blood pressure) of the user, and a place atwhich the user is currently located (that is, a location at which theuser is currently located).

A method for requesting, by the first terminal, the wearable device todistribute the first function resource to the first terminal may be thatthe first terminal obtains a state of the first function resource first,and then the first terminal determines, based on the state of the firstfunction resource, whether to request the wearable device to distributethe first function resource to the first terminal; or may be that afterestablishing a connection to the wearable device, the first terminaldirectly sends a distribution request to the wearable device, to requestthe wearable device to distribute the first function resource to thefirst terminal. Herein, an example in which the first terminal obtainsthe state of the first function resource first, and then the firstterminal determines, based on the state of the first function resource,whether to request the wearable device to distribute the first functionresource to the first terminal is used for description.

FIG. 3A and FIG. 3B are a schematic flowchart of a function resourceconfiguration method according to an embodiment of this application. Thefunction resource configuration method may be applied to thecommunications system shown in FIG. 1 or FIG. 2.

Referring to FIG. 3A and FIG. 3B, the function resource configurationmethod includes the following steps.

S300: Pair a wearable device with a first terminal.

In this embodiment of this application, a manner of pairing the wearabledevice with the first terminal may be a BR (Basic Rate, a conventionalBluetooth mode) manner, or may be an NFC manner, or may be a BLE(Bluetooth Low Energy, Bluetooth low energy) manner. This is notspecifically limited in this embodiment of this application.

S301: The first terminal sends a state query request carrying anidentifier of a first function resource and an identifier of the firstterminal to the wearable device.

After being successfully paired with the wearable device, the firstterminal communicates with the wearable device, so that the firstterminal can use a function resource in the wearable device, therebyimplementing a corresponding function.

Specifically, for the first function resource in the wearable device,when using the first function resource, the first terminal may send thestate query request carrying the identifier of the first functionresource and the identifier of the first terminal to the wearable devicefirst, so that the first terminal can obtain a state of the firstfunction resource and perform subsequent processing based on the stateof the first function resource.

In this embodiment of this application, the identifier of the firstterminal may be a MAC (Media Access Control, Media Access Control)address of the first terminal, or may be a user account used by clientsoftware in the first terminal, or may be another identifier used toindicate the first terminal. This is not specifically limited in thisembodiment of this application.

In this embodiment of this application, for the identifier of the firstfunction resource, refer to the foregoing explanations of the functionresource, and details are not described herein again.

It is easily understood that, to distinguish between different messagetypes, the state query request in this embodiment of this applicationfurther carries a first identifier, and the first identifier is used toindicate that the message is the state query request. Therefore, thestate query request carries at least the first identifier, theidentifier of the terminal, and the identifier of the first functionresource.

It should be noted that a format of the state query request is notspecifically limited in this embodiment of this application.

For example, if the format of the state query request is “the firstidentifier: the identifier of the function resource: the identifier ofthe terminal”, the first identifier is state request (state query), theidentifier of the first function resource is 1001, and the identifier ofthe first terminal is A, the state query request is “state request:1001: A”.

In this embodiment of this application, client software that can performcommunication by using a function resource in the wearable device isembedded in the first terminal. The client software may include a commonsport and health application.

It should be noted that the client software in this embodiment of thisapplication may be an application embedded in the first terminal, or maybe an application provided by a third-party service provider installedby a user. This is not specifically limited in this embodiment of thisapplication.

Specifically, in this embodiment of this application, the sending, bythe first terminal, a state query request to the wearable device isapplicable to the following two scenarios:

1. After the first terminal is successfully paired with the wearabledevice, the first terminal communicates with the wearable device,obtains identifiers of all function resources included in the wearabledevice, and displays all functions included in the wearable device, sothat the user of the first terminal learns about the functions includedin the wearable device.

In a scenario in which the user selects and triggers to query a firstfunction (a function implemented by the first function resource), thefirst terminal sends the state query request to the wearable device.

2. After the first terminal is successfully paired with the wearabledevice, in a scenario in which the user selects and triggers to query afirst function, the first terminal sends the state query request to thewearable device.

Specifically, in the first scenario, as shown in FIG. 3A and FIG. 3B,the first terminal further performs S302 after S300 and before S301, andperforms S306 after S301.

S302: The first terminal obtains identifiers of all function resourcesincluded in the wearable device, and displays functions indicated by theidentifiers of all the function resources.

Optionally, in this embodiment of this application, a method forobtaining, by the first terminal, the identifiers of all the functionresources included in the wearable device may be that the first terminalsends a function query request based on the Bluetooth SDP (ServiceDiscovery Protocol, Service Discovery Protocol); and correspondingly,the first terminal can receive a response that is sent by the wearabledevice and that carries the identifiers of all the function resourcesincluded in the wearable device, and obtain, based on the response, theidentifiers of all the function resources included in the wearabledevice.

For a process of obtaining, by the first terminal, the identifiers ofall the function resources included in the wearable device, refer to aprocess of obtaining, by any terminal, an identifier of a functionresource by using the Bluetooth SDP in the prior art, and details arenot described herein again.

It should be noted that in this embodiment of this application, themethod for obtaining, by the first terminal, identifiers of all functionresources included in the wearable device may alternatively be any otherservice discovery method in the prior art, for example, a GAIT (GenericAttribute Profile, generic attribute profile) discovery process. This isnot specifically limited in this embodiment of this application.

Because S302 is an optional step, S302 is represented by using a dashedline box in FIG. 3A and FIG. 3B.

Specifically, in the second scenario, as shown in FIG. 3A and FIG. 3B,after performing S301, the first terminal performs S303.

S303: The wearable device detects whether a function resource listincludes the identifier of the first function resource.

It can be learned with reference to the foregoing Table 1 that thefunction resource list stores the identifiers of all the functionresources included in the wearable device. Therefore, the wearabledevice may determine, based on the function resource list, whether thewearable device includes the first function resource.

Because S303 is an optional step, S303 is represented by using a dashedline box in FIG. 3A and FIG. 3B.

S304: If the function resource list does not include the identifier ofthe first function resource, the wearable device sends a terminationresponse to the first terminal.

The termination response is used to indicate that the wearable devicedoes not include the first function resource, or is used to indicatethat the first terminal is forbidden to use the first function resource.

S305: The first terminal terminates requesting the wearable device todistribute the first function resource to the first terminal.

S306: If the function resource list includes the identifier of the firstfunction resource, the wearable device detects whether a functionresource occupation list includes the identifier of the first functionresource.

It can be learned with reference to the foregoing Table 2 that thefunction resource occupation list stores a correspondence between anidentifier of a function resource that is already occupied and anidentifier of a terminal that occupies the function resource. Therefore,the wearable device may determine, based on the function resourceoccupation list, which terminal occupies which function resource.

Specifically, if the function resource occupation list does not includethe identifier of the first function resource, it indicates that thefirst function resource is not occupied by any terminal, and in theconfiguration method provided in this embodiment of this application,S307 to S311 are performed after S306. If the function resourceoccupation list includes the identifier of the first function resource,it indicates that the first function resource is already occupied by aterminal, and in the configuration method provided in this embodiment ofthis application, S312 to S316 are performed after S306.

S307: If the function resource occupation list does not include theidentifier of the first function resource, the wearable devicedetermines that the first function resource is not occupied, and sends astate query response carrying a second state identifier to the firstterminal.

The second state identifier is used to indicate that the first functionresource is not occupied by any terminal, that is, the wearable devicedoes not distribute the first function resource to a terminal. Both thefirst terminal and the wearable device may identify the second stateidentifier.

For explanations related to the state query response, refer tosubsequent content.

S308: The first terminal sends a distribution request to the wearabledevice.

After receiving the state query response that carries the second stateidentifier and that is sent by the wearable device, the first terminallearns, based on the second state identifier in the state queryresponse, that the first function resource is not occupied by anyterminal. In this way, the first terminal may directly request thewearable device to distribute the first function resource to the firstterminal.

Specifically, the first terminal sends the distribution request carryingthe identifier of the first function resource to the wearable device, torequest the wearable device to distribute the first function resource tothe first terminal.

To distinguish between different message types, the distribution requestin this embodiment of this application further carries a secondidentifier, and the second identifier is used to indicate that themessage is the distribution request. Therefore, the distribution requestcarries at least the second identifier and the identifier of the firstfunction resource.

It should be noted that a format of the distribution request is notspecifically limited in this embodiment of this application.

For example, if the format of the distribution request is “the secondidentifier: the identifier of the function resource”, the secondidentifier is request distribution (the distribution request), and theidentifier of the first function resource is 1001, the distributionrequest is “request distribution: 1001”.

Optionally, the distribution request may further carry the identifier ofthe first terminal.

S309: The wearable device displays an interaction interface, to remind auser whether to allow to distribute the first function resource to thefirst terminal.

S310: If the wearable device allows to distribute the first functionresource to the first terminal, the wearable device sends a notificationmessage used to instruct the first terminal to use the first functionresource to the first terminal.

S311: The first terminal uses the first function resource, implements acorresponding function, and displays a corresponding interface.

It should be noted that in the configuration method provided in thisembodiment of this application, S310 may be directly performed afterS308. Therefore, S309 is an optional step, and is represented by using adashed line box in FIG. 3A and FIG. 3B.

It may be understood that after receiving the distribution request, thewearable device displays the interaction interface, so that the userdetermines whether to agree to distribute the first function resource tothe first terminal. It should be noted that the user herein is a userwho uses the wearable device.

For example, if a smartphone requests to use a function of detectingblood pressure of a user in a smartwatch, the smartwatch displays“whether to allow the smartphone to use the function of detecting bloodpressure of a user”, and displays words “Yes” and “No”. In this way,after seeing the displayed information, a user who uses the smartwatchmay select “Yes” or “No” to express willingness of the user.

Specifically, when receiving a first instruction that is entered by theuser and that is used to indicate that distribution of the firstfunction resource to the first terminal is allowed, the wearable deviceallows to distribute the first function resource to the first terminal,and sends the notification message to the first terminal, so that thefirst terminal uses the first function resource. The notificationmessage may be an ACK message, or may be a message that carries theidentifier of the first function resource and that is used to indicatean acknowledgment. This is not specifically limited in this embodimentof this application.

Correspondingly, if the wearable device forbids to distribute the firstfunction resource to the first terminal, the wearable device sends thetermination response to the first terminal, that is, S304 is performed.

S312: If the function resource occupation list includes the identifierof the first function resource, the wearable device detects whether anidentifier, of a terminal, that corresponds to the identifier of thefirst function resource in the function resource occupation list is thesame as the identifier of the first terminal.

It can be learned from the foregoing descriptions that if the functionresource occupation list includes the identifier of the first functionresource, it indicates that the first function resource is alreadyoccupied. In this way, the wearable device may further determine, basedon the identifier of the terminal that occupies the first functionresource, which terminal already occupies the first function resource.

S313: If the identifier, of the terminal, that corresponds to theidentifier of the first function resource in the function resourceoccupation list is the same as the identifier of the first terminal, thewearable device determines that a state of the first function resourceis that the first function resource is already occupied by the firstterminal, and sends a state query response carrying a third stateidentifier to the first terminal.

The third state identifier is used to indicate that the first functionresource is already occupied by the first terminal, that is, thewearable device already distributes the first function resource to thefirst terminal.

It should be noted that a scenario to which the state in which the firstfunction resource is already occupied by the first terminal isapplicable is: Before the first terminal is paired with the wearabledevice this time, the first terminal is already successfully paired withthe wearable device, and the first terminal already occupies the firstfunction resource. However, due to some reasons, the first terminal isdisconnected from the wearable device.

Specifically, after S313, the first terminal performs S311, that is,after receiving the state query response carrying the third stateidentifier, the first terminal directly uses the first function resourcebased on the third state identifier in the state query response,implements the corresponding function, and displays the correspondinginterface.

For example, a smartphone is paired with a smartband by using Bluetooth,and the smartphone uses a sport and health function in the smartband. Inthis way, the smartband stores a correspondence between the sport andhealth function and the smartphone. At a first moment, a distancebetween the smartphone and the smartband increases. Consequently, aBluetooth connection between the smartphone and the smartband isdisconnected. At a second moment (the second moment is later than thefirst moment), the distance between the smartphone and the smartbanddecreases. The distance may satisfy the Bluetooth connection between thesmartphone and the smartband, and no other terminals are connected anduse the sport and health function of the smartband between the firstmoment and the second moment, and then the smartband is reconnected tothe smartphone. After the smartband is reconnected to the smartphone,the smartphone can still use the sport and health function.

It should be noted that in this embodiment of this application, that thefirst function resource is already occupied by the first terminal (thefirst terminal occupies the first function resource) is different fromthat the first terminal uses the first function resource. After thewearable device distributes the first function resource to the firstterminal, the first terminal may occupy the first function resource.During a period in which the first terminal occupies the first functionresource, the first terminal may not use the first function resource.However, during a period in which the first terminal uses the firstfunction resource, the first terminal certainly occupies the firstfunction resource.

S314: If an identifier, of a terminal, corresponding to the identifierof the first function resource in the function resource occupation listis an identifier of a second terminal, and the identifier of the secondterminal is different from the identifier of the first terminal, thewearable device determines that the first function resource is alreadyoccupied by the second terminal, and sends a state query responsecarrying a first state identifier to the first terminal, where the firststate identifier is used to indicate that the first function resource isalready occupied by the second terminal.

For explanations about that the first function resource is alreadyoccupied by the second terminal, refer to the foregoing explanationsabout that the first function resource is already occupied by the firstterminal, and details are not described herein again.

S315: The first terminal displays an interaction interface, to notifythe user that the first function resource is already occupied by thesecond terminal.

S316: The first terminal determines whether to use the first functionresource.

If the first terminal determines to use the first function resource,S308 is performed, to complete S309, S310, and S311. If the firstterminal determines not to use the first function resource, S305 isperformed.

It may be understood that after determining that the first functionresource is already occupied by the second terminal, the first terminaldetermines, by displaying the information to the user of the firstterminal and based on the instruction entered by the user, whether touse the first function resource.

Specifically, if the first terminal receives a third instruction that isentered by the user and that is used to instruct to request the wearabledevice to distribute the first function resource to the first terminal,the first terminal determines to occupy the first function resource.

For the interaction interface displayed by the first terminal, refer tothe interaction interface displayed by the wearable device, and detailsare not described herein again.

It can be learned from the foregoing descriptions that in thisembodiment of this application, there are the state query responsecarrying the first state identifier, the state query response carryingthe second state identifier, and the state query response carrying thethird state identifier. In this embodiment of this application,regardless of which state identifier a state query response carries, thestate query response further carries a third identifier and theidentifier of the function resource, and the third identifier is used toindicate that the message is the state query response. Therefore, thestate query response carries at least the third identifier, theidentifier of the function resource, and the state identifier.

It should be noted that a format of the state query response is notspecifically limited in this embodiment of this application.

For example, if the format of the state query response is “the thirdidentifier: the identifier of the function resource: the stateidentifier”, the third identifier is state response (the stateresponse), the identifier of the first function resource is 1001, andthe first state identifier is state 2, the state query response carryingthe first state identifier is “state response: 1001: state 2”.

Further, in the configuration method provided in this embodiment of thisapplication, in a scenario in which the first terminal determines to usethe first function resource, when performing S310, the wearable devicenotifies the second terminal that the second terminal cannot continue tooccupy the first function resource at this moment, and changes theidentifier, of the terminal, that corresponds to the identifier of thefirst function resource in the function resource occupation list of thewearable device, that is, changes the identifier of the second terminalto the identifier of the first terminal, so as to ensure correctness ofthe correspondence stored in the function resource occupation list.

In addition, in the scenario in which the first terminal determines touse the first function resource, after the first terminal performs S308,the wearable device may further determine, based on a time in which thesecond terminal occupies the first function resource (referred to asoccupation duration for short), whether to allow the first terminal touse the first function resource. Specifically, if the wearable devicedetects that the occupation duration is greater than or equal to apreset threshold, the wearable device allows the first terminal to usethe first function resource, and performs S310. If the wearable devicedetects that the occupation duration is less than the preset threshold,the wearable device forbids the first terminal to use the first functionresource and performs S304, or may directly perform S309. This is notspecifically limited in this embodiment of this application. Thedetermining, by the wearable device in this manner, whether to allow thefirst terminal to use the first function resource is not shown in FIG.3A and FIG. 3B.

In addition, in the scenario in which the first terminal determines touse the first function resource, after the first terminal performs S308,the wearable device may alternatively determine, by comparing a priorityof the first terminal with a priority of the second terminal, whether toallow the first terminal to use the first function resource.Specifically, if the priority of the first terminal is higher than thepriority of the second terminal, the wearable device allows the firstterminal to use the first function resource and performs S310. If thepriority of the first terminal is lower than the priority of the secondterminal, the wearable device forbids the first terminal to use thefirst function resource and performs S304, or may directly perform S309.This is not specifically limited in this embodiment of this application.If the priority of the first terminal is equal to the priority of thesecond terminal, the wearable device may directly allow the firstterminal to use the first function resource and perform S310, or maydirectly perform S309, or may determine, by using another manner,whether to allow the first terminal to use the first function resource.This is not specifically limited in this embodiment of this application.Similarly, the determining, by the wearable device in this manner,whether to allow the first terminal to use the first function resourceis not shown in FIG. 3A and FIG. 3B.

Optionally, the priority of the first terminal and the priority of thesecond terminal may be set by the user of the wearable device. Forexample, if the user of the wearable device sets that when the firstterminal applies to use a function of detecting blood pressure of a userin the wearable device, the first terminal is always allowed to use thefunction of detecting blood pressure of a user; and the user of thewearable device sets that when the second terminal applies to use thefunction of detecting blood pressure of a user in the wearable device, abox is popped up first to ask the user whether to allow the secondterminal to use the function of detecting blood pressure of a user. Inthis way, the priority of the first terminal is higher than the priorityof the second terminal.

Optionally, the user may set different priorities or permissions fordifferent terminals on the wearable device. The user of the wearabledevice may set that the first terminal and the second terminal arealways allowed to use the function of detecting blood pressure of auser. If the first terminal already occupies a function resource fordetecting blood pressure of a user, when the second terminal applies touse the function of detecting blood pressure of a user, the wearabledevice may directly allow the second terminal to use the function ofdetecting blood pressure of a user without displaying the interactioninterface. For example, a user may set, on a smartwatch, that a mobilephone 1 and a mobile phone 2 of the user are always allowed to use allfunction resources or some function resources in the smartwatch. In thisway, the user may smoothly switch the mobile phone to view or use somefunction resources in the smartwatch without confirming on a displayinterface for a plurality of times, thereby improving user experience.In addition, the user may set different permissions for mobile phones ofother users on the wearable device. For example, the user may allow amobile phone of another user such as a personal trainer or a personaldoctor to use a function resource in the smartwatch, but use of thefunction resource needs to be confirmed by the user.

Further, in this embodiment of this application, when determining thatthe first terminal does not use the first function resource any more,the first terminal may send a connection termination message to thewearable device, to disconnect the wearable device from the firstterminal, so that the first function resource in the wearable device isreleased. Correspondingly, the wearable device deletes thecorrespondence between the identifier of the first function resource andthe identifier of the first terminal from the function resourceoccupation list of the wearable device.

Optionally, the first function resource in this embodiment of thisapplication may be a resource with a user attribute, or may be aresource without a user attribute. A resource with a user attribute maybe construed as a function resource that needs to obtain and/or storerelated data corresponding to a user during running. For example, duringrunning, a function resource used to implement a function of detectingblood pressure of a user needs to obtain and/or store data indicatingthe blood pressure of the user. Correspondingly, a resource without auser attribute may be construed as a function resource that does notneed to obtain and/or store related data corresponding to a user duringrunning, for example, a Bluetooth earphone function resource. TheBluetooth earphone function resource is only used to implement a callfunction of a user, and does not need to store related data. The musicplay function resource is only used to implement a function of playingmusic for a terminal, and does not need to store related data of a user.

Optionally, in an application scenario in which the wearable device doesnot include a display screen, if a terminal requests the wearable deviceto distribute the first function resource to the terminal, the wearabledevice may remind a user by using vibration, ringing, or a combinationof vibration and ringing. The user of the wearable device may express,by using knocking or shaking, whether the user agrees to distribute thefirst function resource to the terminal.

In this embodiment of this application, the wearable device includes atleast one function resource. For the first function resource in the atleast one function resource, even if the first function resource isalready occupied by the second terminal, after receiving thedistribution request sent by the first terminal, the wearable devicealso determines, based on the distribution request received by thewearable device, whether to allow the first terminal to use the firstfunction resource. If the wearable device allows the first terminal touse the first function resource, the wearable device sends thenotification message to the first terminal, to instruct the firstterminal to use the first function resource. In this way, in a scenarioin which the first function resource is already occupied by the secondterminal, the first terminal may also use the first function resource.

To describe the function resource configuration method shown in FIG. 3Aand FIG. 3B in a more detailed manner, in this embodiment of thisapplication, the following example is used for description: The wearabledevice is a smartwatch A including a display screen; the smartwatch Aincludes a function resource for detecting blood pressure of a user, afunction resource for detecting a heart rate of the user, and a functionresource for detecting walking of the user; both the smartphone 1 andthe smartphone 2 are paired with the smartwatch A in a BLE manner; afterbeing successfully paired with the smartwatch A, both the smartphone 1and the smartphone 2 obtain identifiers of all function resourcesincluded in the smartwatch A; and the smartwatch A determines, based onan instruction entered by the user, whether to distribute a functionresource to the smartphone 1 or the smartphone 2.

With reference to Table 1, in this embodiment of this application, afunction resource 1001 is used to indicate the function resource fordetecting blood pressure of a user, a function resource 1002 is used toindicate the function resource for detecting walking of the user, and afunction resource 1003 is used to indicate the function resource fordetecting a heart rate of the user.

Referring to FIG. 4A and FIG. 4B, a function resource configurationmethod according to an embodiment of this application includes thefollowing steps.

S400: A smartphone 1 is paired with a smartwatch A in a BLE manner.

For a specific method for pairing the smartphone 1 with the smartwatch Ain the BLE manner, refer to a process of pairing any two differentterminals in a BLE manner in the prior art, and details are notdescribed herein.

S401: The smartphone 1 obtains, based on the GATT protocol, identifiersof all function resources included in the smartwatch A, and displaysfunctions indicated by the identifiers of all the function resources.

Specifically, the smartphone 1 sends a function query request to thesmartwatch A based on the GATT protocol, and the smartwatch A sends, tothe smartphone 1 based on the function query request, a responsecarrying the identifiers of all the function resources included in thesmartwatch A. In this way, the smartphone 1 may obtain the identifiersof all the function resources included in the smartwatch A. Afterobtaining the identifiers of all the function resources included in thesmartwatch A, the smartphone 1 displays the functions included in thesmartwatch A on a display screen of the smartphone 1, so that a user ofthe smartphone 1 can intuitively learn about, by using the smartphone 1,the functions included in the smartwatch A.

In this embodiment of this application, an area in which the smartphone1 displays the functions included in the smartwatch A may be any area ofthe display screen of the smartphone 1. This is not specifically limitedin this embodiment of this application. In addition, a manner ofdisplaying, by the smartphone 1, the functions included in thesmartwatch A may be a list form or an icon form. This is notspecifically limited in this embodiment of this application.

As shown in FIG. 5, in this embodiment of this application, afterobtaining the identifiers of all the function resources included in thesmartwatch A, the smartphone 1 displays, in the list form in a firstarea of the display screen of the smartphone 1, that the smartwatch Aincludes a function of detecting blood pressure, a function of detectinga heart rate, and a function of detecting walking. The display interfaceshown in FIG. 5 includes a function switch control, a state querycontrol, an icon of the smartwatch A, an icon of detecting bloodpressure, an icon of detecting a heart rate, an icon of detectingwalking, and another common icon. The user may learn, by viewing theinterface shown in FIG. 5, that the smartwatch A includes the functionof detecting blood pressure, the function of detecting a heart rate, andthe function of detecting walking.

For a detailed process of obtaining, by the smartphone 1, theidentifiers of all the function resources included in the smartwatch A,refer to a process of obtaining, by any terminal, an identifier of afunction resource based on the GAIT protocol in the prior art, anddetails are not described herein.

S402: The smartphone 1 sends a state query request carrying anidentifier 1001 of a function resource and an identifier of thesmartphone 1 to the smartwatch A.

Specifically, after the smartphone 1 displays the functions included inthe smartwatch A, the user of the smartphone 1 may select one of thefunctions, and trigger the smartphone 1 to query a state of a functionresource corresponding to the function from the smartwatch A. Withreference to FIG. 5, the user taps a state query control of one of thefunctions, to trigger the smartphone 1 to query a state of a functionresource corresponding to the state query control from the smartwatch A.

In this embodiment of this application, an example in which thesmartphone 1 sends the state query request carrying the identifier 1001of the function resource and the identifier of the smartphone 1 to thesmartwatch A is used for description. The function resource 1001 is usedto detect blood pressure. With reference to FIG. 5, as shown in FIG. 6,the user taps a state query control of a function of detecting bloodpressure, to trigger the smartphone 1 to send the state query requestcarrying the identifier 1001 of the function resource and the identifierof the smartphone 1 to the smartwatch A.

S403: When determining, based on the identifier 1001 of the functionresource and a function resource occupation list, that the functionresource 1001 is not occupied by any terminal, the smartwatch A sends astate query response carrying a second state identifier to thesmartphone 1, where the second state identifier is used to indicate thatthe function resource 1001 is not occupied by any terminal.

The smartwatch A stores the function resource occupation list. For thefunction resource occupation list, refer to the foregoing Table 2. Thesmartwatch A may determine, based on the function resource occupationlist, whether the function resource 1001 is already occupied by aterminal, that is, the smartwatch A may determine a state of thefunction resource 1001 based on the function resource occupation list.

For a method for determining, by the smartwatch A, the state of thefunction resource 1001, refer to the embodiment of FIG. 3A and FIG. 3B,and details are not described herein again.

Specifically, when determining that the function resource 1001 is notoccupied by any terminal, the smartwatch A sends the state queryresponse carrying the second state identifier to the smartphone 1. Thesecond state identifier is used to indicate that the function resource1001 is not occupied by any terminal.

For example, in this embodiment of this application, the second stateidentifier is Status 0 (state 0), the smartwatch A sends a state queryresponse carrying Status 0 to the smartphone 1, to notify the smartphone1 that the function resource 1001 is not occupied by any terminal.

Correspondingly, the smartphone 1 displays that the function ofdetecting blood pressure is not occupied. With reference to FIG. 6, asshown in FIG. 7, if the function resource 1001 is not occupied by anyterminal, the smartphone 1 displays that the function resource 1001 isnot occupied.

S404: The smartphone 1 sends a distribution request to the smartwatch A,to request the smartwatch A to distribute the function resource 1001 tothe smartphone 1.

Specifically, after the smartphone 1 displays that the function resource1001 is not occupied by any terminal, the user of the smartphone 1 mayselect to apply for using the function of detecting blood pressure, andtrigger the smartphone 1 to send the distribution request to thesmartwatch A, to request the smartwatch A to distribute the functionresource 1001 to the smartphone 1.

With reference to FIG. 7, as shown in FIG. 8, the user slides a functionswitch control of the function of detecting blood pressure, to triggerthe smartphone 1 to send the distribution request to the smartwatch A,to request to use the function of detecting blood pressure.

S405: The smartwatch A displays an interaction interface, to remind auser whether to allow to distribute the function resource 1001 to thesmartphone 1.

It is easily understood that, that the smartwatch A reminds the userwhether to allow to distribute the function resource 1001 to thesmartphone 1 is essentially reminding the user whether to allow thesmartphone 1 to use the function of detecting blood pressurecorresponding to the function resource 1.

For example, as shown in FIG. 9, after receiving the distributionrequest, the smartwatch A displays “The function of detecting bloodpressure is not used, whether to allow the smartphone 1 to use thefunction of detecting blood pressure?” on a blood pressure displayinterface based on the distribution request, and displays two controls“Yes” and “No”. It may be understood that when the smartphone 1 appliesto use the function resource 1, if the function resource 1001 is notoccupied or used by any terminal, the smartwatch A may alternativelydirectly agree the request of the smartphone 1 to allow the smartphone 1to use the function resource 1001 without displaying the userinteraction interface.

S406: If the smartwatch A allows to distribute the function resource1001 to the smartphone 1, the smartwatch A sends a notification messageto the smartphone 1, to instruct the smartphone 1 to use the functionresource 1001.

It can be learned from S405 that the smartwatch A may determine, basedon an instruction entered by the user, whether to allow to distributethe function resource 1001 to the smartphone 1.

Specifically, with reference to FIG. 9, if the user taps “Yes”, thesmartwatch A allows to distribute the function resource 1001 to thesmartphone 1, and the smartwatch A sends the notification message to thesmartphone 1, to instruct the smartphone 1 to use the function resource1001. If the user taps “No”, the smartwatch A forbids to distribute thefunction resource 1001 to the smartphone 1, and the smartwatch A sends atermination response to the smartphone 1, to indicate that thesmartwatch A forbids the smartphone 1 to use the function resource 1001.In FIG. 4A and FIG. 4B, a case in which the smartphone 1 is forbidden touse the function resource 1001 is not shown.

The smartwatch A reminds the user whether to allow to distribute thefunction resource 1001 to the smartphone 1, and determines, based on aselection of the user, a manner of sending the notification message orthe termination response to the smartphone 1, thereby ensuring securityof the function resource 1001, and improving user experience.

When the smartwatch A allows to distribute the function resource 1001 tothe smartphone 1, the smartwatch A stores a correspondence between thefunction resource 1001 and the smartphone 1 in the function resourceoccupation list, to indicate that the function resource 1001 is alreadyoccupied by the smartphone 1.

It should be noted that in the configuration method provided in thisembodiment of this application, S406 may be directly performed afterS404. Therefore, S405 is an optional step, and is represented by using adashed line box in FIG. 4A and FIG. 4B.

S407: The smartphone 1 uses the function resource 1001 based on thenotification message received by the smartphone 1, to implement afunction of detecting blood pressure, and displays a correspondinginterface.

After receiving the notification message used to instruct the smartphone1 to use the function resource 1001, the smartphone 1 may use thefunction resource 1001 based on the notification message. In addition,the smartphone 1 may further display functions of the smartwatch A thatare being used by the smartphone 1, and functions that the smartphone 1may attempt to apply for and use.

For example, with reference to FIG. 8, as shown in FIG. 10, afterreceiving the notification message, the smartphone 1 displays that thesmartphone 1 already successfully occupies a function resource fordetecting blood pressure, and the user may further apply for usingrespectively corresponding functions by sliding a function switchcontrol of the function of detecting a heart rate and a function switchcontrol of the function of detecting walking.

Further, it is assumed that the smartphone 1 is disconnected from thesmartwatch A, for example, a Bluetooth function of the smartphone 1 isdisabled for two minutes, and there are no other terminals applying forusing the function resource 1001 within the two minutes. After the twominutes, the Bluetooth function of the smartphone 1 is enabled again.Then. S408 to S412 are performed between the smartphone 1 and thesmartwatch A. Because S409 is an optional step, S409 is represented byusing a dashed line in FIG. 4A and FIG. 4B.

S408: The smartphone 1 is paired with the smartwatch A in the BLEmanner.

S409: The smartphone 1 obtains, based on the GAIT protocol, theidentifiers of all the function resources included in the smartwatch A,and displays the functions indicated by the identifiers of all thefunction resources.

S410: The smartphone 1 sends a state query request carrying theidentifier 1001 of the function resource and the identifier of thesmartphone 1 to the smartwatch A.

S408 to S410 are the same as S400 to S402 in this embodiment of thisapplication, and details are not described herein again.

S411: When determining, based on the identifier 1001 of the functionresource and the function resource occupation list, that the functionresource 1001 is already occupied by the smartphone 1, the smartwatch Asends a state query response carrying a third state identifier to thesmartphone 1, where the third state identifier is used to indicate thatthe function resource 1001 is already occupied by the smartphone 1.

Specifically, after receiving the state query request carrying theidentifier 1001 of the function resource and the identifier of thesmartphone 1, the smartwatch A queries the function resource occupationlist stored by the smartwatch A, to determine whether the functionresource 1001 is already occupied by a terminal.

Before the two minutes, the smartphone 1 already occupies the functionresource 1001, and no other terminals occupy the function resource 1001within the two minutes during which a Bluetooth connection between thesmartphone 1 and the smartwatch A is disconnected. Therefore, theidentifier 1001 of the function resource in the function resourceoccupation list stored by the smartwatch A still corresponds to thesmartphone 1. In this way, the smartwatch A determines, based on theidentifier 1001 of the function resource and the function resourceoccupation list, that the function resource 1001 is already occupied bythe smartphone 1.

After determining that the function resource 1001 is already occupied bythe smartphone 1, the smartwatch A sends the state query responsecarrying the third state identifier to the smartphone 1, to notify thesmartphone 1 that the function resource 1001 is already occupied by thesmartphone 1.

For example, in this embodiment of this application, the third stateidentifier is Status 1 (state 1), the smartwatch A sends a state queryresponse carrying Status 1 to the smartphone 1, to notify the smartphone1 that the function resource 1001 is already occupied by the smartphone1.

S412: The smartphone 1 uses the function resource 1001 based on thethird state identifier, to implement the function of detecting bloodpressure of the user, and displays the corresponding interface.

The smartphone 1 learns, based on the third state identifier, that thesmartphone 1 already occupies the function resource 1001. Therefore, thesmartphone 1 may implement the function of detecting blood pressure ofthe user by directly using the function resource 1001. S412 is the sameas S407, and details are not described herein again.

Generally, a process of S408 to S412 may be: A function switch of thefunction of detecting blood pressure in the smartphone 1 is alreadyenabled, and the smartphone 1 already uses the function of detectingblood pressure. Because a distance between the smartphone 1 and thesmartwatch A increases, the Bluetooth connection between the smartphone1 and the smartwatch A is disconnected. During a process in which theBluetooth connection is disconnected, no other terminals apply for usingthe function of detecting blood pressure. Because the function switch ofthe function of detecting blood pressure in the smartphone 1 is notdisabled, after the smartphone 1 is reconnected to the smartwatch A, thesmartphone 1 may directly use the function of detecting blood pressureagain.

Further, if in a process in which the smartphone 1 occupies the functionresource 1001, a smartphone 2 is paired with the smartwatch A in the BLEmanner, and the smartphone 2 requests the smartwatch A to distribute thefunction resource 1001 to the smartphone 2, the smartwatch A and thesmartphone 2 perform S413 to S421.

S413: A smartphone 2 is paired with the smartwatch A in the BLE manner.

S414: The smartphone 2 obtains, based on the GATT protocol, theidentifiers of all the function resources included in the smartwatch A.and displays the functions indicated by the identifiers of all thefunction resources.

S415: The smartphone 2 sends a state query request carrying theidentifier 1001 of the function resource and an identifier of thesmartphone 2 to the smartwatch A.

A principle of S413 to S415 is the same as that of S400 to S402 in thisembodiment of this application, and details are not described hereinagain. A difference lies in that S400 to S402 are performed by thesmartphone 1, and S413 to S415 are performed by the smartphone 2.

S416: When determining, based on the identifier 1001 of the functionresource and the function resource occupation list, that the functionresource 1001 is already occupied by the smartphone 1, the smartwatch Asends a state query response carrying a first state identifier to thesmartphone 2, where the first state identifier is used to indicate thatthe function resource 1001 is already occupied by the smartphone 1.

It can be learned with reference to the foregoing descriptions that inthe function resource occupation list stored by the smartwatch A, theidentifier 1001 of the function resource corresponds to thesmartphone 1. In this way, the smartwatch A determines, based on theidentifier 1001 of the function resource and the function resourceoccupation list, that the function resource 1001 is already occupied bythe smartphone 1.

After determining that the function resource 1001 is already occupied bythe smartphone 1, the smartwatch A sends the state query responsecarrying the first state identifier to the smartphone 2, to notify thesmartphone 2 that the function resource 1001 is already occupied byanother smartphone.

For example, in this embodiment of this application, the first stateidentifier is Status 2 (state 2), the smartwatch A sends a state queryresponse carrying Status 2 to the smartphone 2, to notify the smartphone2 that the function resource 1001 is already occupied by anothersmartphone.

S417: The smartphone 2 displays an interaction interface based on thefirst state identifier, to remind a user whether to use the functionresource 1001.

For example, as shown in FIG. 11, after receiving a second notificationcarrying the first state identifier, the smartphone 2 displays “Alreadyused by another terminal. Please enable the function switch if you stillwant to use the function of detecting blood pressure” based on the firststate identifier.

S418: If the smartphone 2 determines to preempt the function resource1001, the smartphone 2 sends a distribution request carrying theidentifier 1001 of the function resource to the smartwatch A, to requestthe smartwatch A to distribute the function resource 1001 to thesmartphone 2.

It is easily understood that the smartphone 2 determines, based on aninstruction entered by the user, whether to preempt the functionresource 1001. With reference to FIG. 11, if the user enables a functionswitch of the function of detecting blood pressure, the smartphone 2determines to preempt the function resource 1001: or if the user doesnot slide a function switch of the function of detecting blood pressure,the smartphone 2 determines not to preempt the function resource 2, sothat the smartphone 2 terminates requesting the function resource 1001.

S419: The smartwatch A displays the interaction interface, to remind theuser whether to allow to distribute the function resource 1001 to thesmartphone 2.

For example, as shown in FIG. 12, after receiving the distributionrequest, the smartwatch A displays “Already used by the smartphone 1. Isthe smartphone 2 allowed to use?” on the blood pressure displayinterface based on the distribution request, and displays two controls“Yes” and “No”.

S420: If the smartwatch A allows to distribute the function resource1001 to the smartphone 2, the smartwatch A sends a notification messageto the smartphone 2, to instruct the smartphone 2 to use the functionresource 1001.

S421: The smartphone 2 uses the function resource 1001 based on thenotification message received by the smartphone 2, to implement thefunction of detecting blood pressure, and displays a correspondinginterface.

For ease of understanding, FIG. 13A and FIG. 13B show a process in whichthe function of detecting blood pressure is already occupied by thesmartphone 1, and the smartphone 2 successfully preempts the function ofdetecting blood pressure.

A principle of S419 to S421 is the same as that of S405 to S407 in thisembodiment of this application, and details are not described hereinagain. A difference lies in that communication between the smartwatch Aand the smartphone 1 is described in S405 to S407, and communicationbetween the smartwatch A and the smartphone 2 is described in S419 toS421.

When allowing to distribute the function resource 1001 to the smartphone2, the smartwatch A notifies the smartphone 1 that the smartphone 1cannot continue to occupy the function resource 1001 at this moment, andfurther changes the smartphone 1 that corresponds to the identifier 1001of the function resource in the function resource occupation list to thesmartphone 2.

In the function resource configuration method provided in thisembodiment of the present invention, the smartphone 1 or the smartphone2 may request the smartwatch A within a short time to distribute atleast two function resources. In this way, the smartwatch A may displaydistribution requests of the smartphone 1 and/or the smartphone 2 forthe function resources in a list form; or may display an interactioninterface by superposing a plurality of different windows (each windowcorresponds to a distribution request); or may display an interactioninterface by tiling a plurality of different windows on a display screenof the smartwatch by displaying each window based on a presetproportion; or may display an interaction interface by displaying onlyone of windows and notifying, in a text form, the user of the restinformation corresponding to the distribution request. This is notspecifically limited in this embodiment of this application. Theforegoing “within a short time” may mean that a preset time is notexceeded, or may mean within a time in which the smartwatch A does notmake a response to a previous function resource that is requested to bedistributed, or may be another meaning. This is not limited in thisembodiment of this application.

It can be learned that by using the function resource configurationmethod provided in this embodiment of this application, the user of thesmartphone 1 or the smartphone 2 may intuitively learn about thefunctions included in the smartwatch A, and learn about a state of afunction resource corresponding to each function, so that the user candetermine whether to use a function based on an actual requirement ofthe user.

In this embodiment of this application, the smartwatch A includes atleast one function resource. For the function resource 1001 in the atleast one function resource, even if the function resource 1001 isalready occupied by the smartphone 1, after receiving the distributionrequest sent by the smartphone 2, the smartwatch A also determines,based on the distribution request received by the smartwatch A, whetherto allow the smartphone 2 to use the function resource 1001. If thesmartwatch A allows the smartphone 2 to use the function resource 1001,the smartwatch A sends the notification message to the smartphone 2, toinstruct the smartphone 2 to use the function resource 1001. In thisway, in a scenario in which the function resource 1001 is alreadyoccupied by the smartphone 1, the smartphone 2 may also use the functionresource 1001.

It can be learned from the foregoing descriptions that in thisembodiment of this application, after establishing a connection to awearable device including a display screen, a first terminal maydirectly send a distribution request to the wearable device, to requestthe wearable device to distribute a first function resource to the firstterminal. Herein, an example in which after establishing the connectionto the wearable device, the first terminal directly sends thedistribution request to the wearable device is used for description.

FIG. 14 is a schematic flowchart of a function resource configurationmethod according to an embodiment of this application. The functionresource configuration method may be applied to the communicationssystem shown in FIG. 1 or FIG. 2.

Referring to FIG. 14, the function resource configuration methodincludes the following steps.

S500: A wearable device is paired with a first terminal.

S500 is the same as S300, and details are not described herein again.

S501: The first terminal sends a distribution request carrying anidentifier of a first function resource and an identifier of the firstterminal to the wearable device.

In this embodiment of this application, after being successfully pairedwith the wearable device, the first terminal directly sends thedistribution request to the wearable device, to request the wearabledevice to distribute the first function resource to the first terminal.

In this embodiment of this application, for the distribution requestsent by the first terminal, refer to descriptions of the distributionrequest sent by the first terminal in the embodiment of FIG. 3A and FIG.3B. A difference lies in: Because in the embodiment of FIG. 3A and FIG.3B, the first terminal sends the state query request first, and thestate query request certainly carries the identifier of the firstterminal, so that the wearable device may determine with which terminalthe wearable device specifically communicates. Therefore, thedistribution request subsequently sent by the first terminal may notcarry the identifier of the first terminal. However, in this embodimentof this application, after being paired with the wearable device, thefirst terminal directly sends the distribution request. To ensure thatthe wearable device can determine a terminal that communicates with thewearable device, in this embodiment of this application, thedistribution request certainly carries the identifier of the firstterminal.

Same as the embodiment of FIG. 3A and FIG. 3B, this embodiment of thisapplication is also applicable to the following two scenarios:

1. After the first terminal is successfully paired with the wearabledevice, the first terminal communicates with the wearable device,obtains identifiers of all function resources included in the wearabledevice, and displays all functions included in the wearable device, sothat a user of the first terminal learns about the functions included inthe wearable device.

In a scenario in which the user selects and triggers to request to use afirst function, the first terminal sends the distribution request to thewearable device.

2. After the first terminal is successfully paired with the wearabledevice, in a scenario in which the user selects and triggers to requestto use a first function, the first terminal sends the distributionrequest to the wearable device.

Specifically, in the first scenario, as shown in FIG. 14, the firstterminal further performs S502 after S500 and before S501, and performsS506 after S501.

S502: The first terminal obtains identifiers of all function resourcesincluded in the wearable device, and displays functions indicated by theidentifiers of all the function resources.

Because S502 is an optional step, S502 is represented by using a dashedline box in FIG. 14.

Specifically, in the second scenario, as shown in FIG. 14, afterperforming S501, the first terminal performs S503.

S503: The wearable device detects whether a function resource listincludes the identifier of the first function resource.

S504: If the function resource list does not include the identifier ofthe first function resource, the wearable device sends a terminationresponse to the first terminal.

S505: The first terminal terminates requesting the wearable device todistribute the first function resource to the first terminal.

S506: If the function resource list includes the identifier of the firstfunction resource, the wearable device detects whether a functionresource occupation list includes the identifier of the first functionresource.

S502 to S506 are the same as S302 to S306, and details are not describedherein again.

S507: If the function resource occupation list does not include theidentifier of the first function resource, the wearable devicedetermines that the first function resource is not occupied, and thewearable device displays an interaction interface, to remind a userwhether to allow to distribute the first function resource to the firstterminal.

In this embodiment of this application, when determining that the firstfunction resource is not occupied, the wearable device may directlydisplay the interaction interface, to remind the user whether to allowto distribute the first function resource to the first terminal, therebyenhancing interaction with the user, improving user experience, andimproving security of the first function resource to some extent.

S508: If the wearable device allows to distribute the first functionresource to the first terminal, the wearable device sends a notificationmessage used to instruct the first terminal to use the first functionresource to the first terminal.

S509: The first terminal uses the first function resource, implements acorresponding function, and displays a corresponding interface.

S508 and S509 are the same as S309 and S310, and details are notdescribed herein again.

It should be noted that in the configuration method provided in thisembodiment of this application, when determining that the first functionresource is not occupied, the wearable device may directly send thenotification message used to instruct the first terminal to use thefirst function resource to the first terminal, that is, S507 is anoptional step.

Correspondingly, if the wearable device forbids to distribute the firstfunction resource to the first terminal, the wearable device sends thetermination response to the first terminal, that is, S504 is performed.

S510: If the function resource occupation list includes the identifierof the first function resource, the wearable device detects whether anidentifier, of a terminal, that corresponds to the identifier of thefirst function resource in the function resource occupation list is thesame as the identifier of the first terminal.

S511: If the identifier, of the terminal, that corresponds to theidentifier of the first function resource in the function resourceoccupation list is the same as the identifier of the first terminal, thewearable device determines that a state of the first function resourceis that the first function resource is already occupied by the firstterminal, and sends the notification message used to instruct the firstterminal to use the first function resource to the first terminal.

S512: If the identifier, of the terminal, that corresponds to theidentifier of the first function resource in the function resourceoccupation list is an identifier of a second terminal, and theidentifier of the second terminal is different from the identifier ofthe first terminal, the wearable device determines that the firstfunction resource is already occupied by the second terminal.

Specifically, after the wearable device determines that the firstfunction resource is already occupied by the second terminal, thewearable device displays the interaction interface, to remind the userwhether to allow to distribute the first function resource to the firstterminal. That is, in this embodiment of this application, after S512,S507 to S509 are further performed.

Further, in the configuration method provided in this embodiment of thisapplication, when performing S508, the wearable device notifies thesecond terminal that the second terminal cannot continue to occupy thefirst function resource at this moment, and changes the identifier, ofthe terminal, that corresponds to the identifier of the first functionresource in the function resource occupation list of the wearabledevice, that is, changes the identifier of the second terminal to theidentifier of the first terminal, so as to ensure correctness of thecorrespondence stored in the function resource occupation list.

In addition, in a scenario in which the first terminal requests todistribute the first function resource to the first terminal, and thefirst function resource is already occupied by the second terminal, thewearable device may further determine, based on occupation duration,whether to allow the first terminal to use the first function resource;or determine, by comparing a priority of the first terminal with apriority of the second terminal, whether to allow the first terminal touse the first function resource. The determining, by the wearable devicein the two manners, whether to allow the first terminal to use the firstfunction resource is not shown in FIG. 14.

Further, in this embodiment of this application, when determining thatthe first terminal does not use the first function resource any more,the first terminal may send a connection termination message to thewearable device, to disconnect the wearable device from the firstterminal, so that the first function resource in the wearable device isreleased. Correspondingly, the wearable device deletes thecorrespondence between the identifier of the first function resource andthe identifier of the first terminal from the function resourceoccupation list of the wearable device.

In conclusion, the embodiment of FIG. 3A and FIG. 3B and the embodimentof FIG. 14 essentially describe communication between the first terminaland the wearable device. In the embodiment of FIG. 3A and FIG. 3B, thewearable device detects the state of the first function resource basedon the state query request, and subsequently determines, based on thedistribution request, whether to allow the first terminal to use thefirst function resource. In the embodiment of FIG. 14, the wearabledevice detects the state of the first function resource based on thedistribution request, and determines, based on the distribution request,whether to allow the first terminal to use the first function resource.That is, the distribution request in the embodiment of FIG. 14 isessentially a message combining the state query request and thedistribution request in the embodiment of FIG. 3A and FIG. 3B.

It should be noted that in this embodiment of this application,communication between the first terminal and the wearable device mayalternatively be implemented by using another message, to achieve anobjective that in a scenario in which the first function resource isalready occupied by the second terminal, the first terminal may also usethe first function resource.

For a more detailed process of the embodiment of FIG. 14, refer to theembodiment of FIG. 4A and FIG. 4B. A difference lies in that a functionof the distribution request in the more detailed process of theembodiment of FIG. 14 is equivalent to functions of the state queryrequest and the distribution request in the embodiment of FIG. 4A andFIG. 4B.

In this embodiment of this application, the wearable device includes atleast one function resource. For the first function resource in the atleast one function resource, even if the first function resource isalready occupied by the second terminal, after receiving thedistribution request sent by the first terminal, the wearable devicealso determines, based on the distribution request received by thewearable device, whether to allow the first terminal to use the firstfunction resource. If the wearable device allows the first terminal touse the first function resource, the wearable device sends thenotification message to the first terminal, to instruct the firstterminal to use the first function resource. In this way, in a scenarioin which the first function resource is already occupied by the secondterminal, the first terminal may also use the first function resource.

An embodiment of this application provides a wearable device. Thewearable device is configured to perform the steps performed by thewearable device in the foregoing function resource configurationmethods. The wearable device provided in this embodiment of thisapplication may include modules corresponding to corresponding steps.

In this embodiment of this application, functional modules of thewearable device may be divided based on the foregoing method examples.For example, functional modules may be divided based on functions, ortwo or more functions may be integrated into one processing module. Theintegrated module may be implemented in a form of hardware, or may beimplemented in a form of a software functional module. In thisembodiment of this application, the module division is an example, andis merely logical function division, and there may be other divisionmanners in actual implementation.

When the functional modules are divided based on the functions, FIG. 15is a schematic diagram of a possible structure of the wearable device inthe foregoing embodiments. As shown in FIG. 15, the wearable deviceincludes a determining unit 150, a sending unit 151, a receiving unit152, a detection unit 153, and a display unit 154. The determining unit150 is configured to support the wearable device to perform S307, S313,and S314 in FIG. 3A and FIG. 3B; the sending unit 151 is configured tosupport the wearable device to perform S304, S307, S310, and S313 inFIG. 3A and FIG. 3B; the receiving unit 152 is configured to support thewearable device to perform S301 and S308 in FIG. 3A and FIG. 3B; thedetection unit 153 is configured to support the wearable device toperform S303, S306, S309, and S312 in FIG. 3A and FIG. 3B; and thedisplay unit 154 is configured to support the wearable device to performS309 in FIG. 3A and FIG. 3B. For function descriptions of thecorresponding functional modules, refer to all related content of thesteps in the foregoing method embodiments, and details are not describedherein again.

When an integrated unit is used, FIG. 16 is a schematic diagram of apossible structure of the wearable device in the foregoing embodiments.As shown in FIG. 16, the wearable device includes a processing module160 and a communications module 161. The processing module 160 isconfigured to control and manage an action of the wearable device. Forexample, the processing module 160 is configured to support the wearabledevice to perform S307, S309. S313, and S314 in FIG. 3A and FIG. 3B,and/or applied to another process of the technology described in thisspecification. The communications module 161 is configured to supportcommunication between the wearable device and a terminal. For example,the communications module 161 is configured to support the wearabledevice to perform S301, S303, S304, S306. S307, S308, S309. S310, S316,and S313 in FIG. 3A and FIG. 3B.

In this embodiment of this application, the processing module 160 may bea processor or a controller, for example, a CPU (Central ProcessingUnit, central processing unit) or a DSP (Digital Signal Processor,digital signal processor). The processing module 160 can implement orperform various examples of logical blocks, modules, and circuitsdescribed with reference to content disclosed in this application.

In this embodiment of this application, the communications module 161may be a Bluetooth module configured to exchange data with an externaldevice, and may further include an RF (Radio Frequency, radio frequency)circuit corresponding to the Bluetooth module. The RF radio frequencycircuit is configured to receive and send a signal during an informationreceiving and sending process or during a call.

In this embodiment of this application, the communications module 161may alternatively be a communications interface (English full name:Communication Interface) configured to exchange data with an externaldevice. The communications module may include two communicationsinterfaces: a sending interface configured to send data to the externaldevice and a receiving interface configured to receive data from theexternal device, that is, the wearable device may separately implementreceiving and sending of data by using two different communicationsinterfaces. Certainly, the communications module 161 may integrate adata receiving function and a data sending function on onecommunications interface, so that the communications interface has thedata receiving function and the data sending function. Thecommunications interface may be integrated on a Bluetooth chip or an NFCchip.

In this embodiment of this application, the communications module 161may alternatively be a transceiver, a transceiver circuit, or the like.

Optionally, the wearable device may further include some input modules162. The input module 162 is configured to implement interaction betweena user and the wearable device.

The input module 162 may receive digit or character information input bythe user, to generate signal input related to a user setting or functioncontrol. In a specific implementation of this application, the inputmodule 162 may be a touch panel, or may be another human-computerinteraction interface such as a substantive input key or a microphone,or may be another external information capturing apparatus such as acamera.

In another implementation of this application, the substantive input keyused by the input module 162 may include, but is not limited to, one ormore of a physical keyboard, a functional key (such as a volume controlkey or an on/off key), a trackball, a mouse, or a joystick. The inputmodule 162 in a form of a microphone may collect a voice input by theuser or from an environment and convert the voice into a command that isin a form of an electrical signal and that can be executed by theprocessing module 160.

Optionally, the wearable device may further include some output modules163. The output module 163 is configured to implement interactionbetween the user and the wearable device.

The output module 163 includes, but is not limited to, an image outputmodule and an audio output module. The image output module is configuredto output a text, a picture, and/or a video. The image output module mayinclude a display panel, for example, a display panel configured in aform of an LCD (Liquid Crystal Display, liquid crystal display), an OLED(Organic Light-Emitting Diode, organic light-emitting diode), an FED(Field Emission Display, field emission display), or the like. The imageoutput module may include a single display panel or a plurality ofdisplay panels of different sizes. In a specific implementation of thisapplication, the touch panel used by the input module 162 may also beused as the display panel of the output module 163. For example, afterdetecting a touch on the touch panel or a gesture operation near thetouch panel, the touch panel transfers the touch or the gestureoperation to the processing module 160, so as to determine a type of atouch event. Then, the processing module 160 provides correspondingvisual output on the display panel based on the type of the touch event.

As shown in FIG. 16, the input module 162 and the output module 163 maybe used as two independent components to implement input and outputfunctions of the wearable device. However, in some embodiments, theinput module 162 and the output module 163 may be integrated toimplement the input and output functions of the wearable device (asshown in FIG. 16, the input module 162 and the output module 163 areincluded in one dashed line box, to indicate that the input module 162and the output module 163 are integrated).

Optionally, in this embodiment of this application, the wearable devicefurther includes a storage module 164, configured to store a functionresource list, and may be further configured to store a functionresource occupation list, and may be further configured to store atleast one function resource.

The storage module 164 may be a memory.

When the processing module 160 is a processor, the communications module161 is a communications interface, the input module 162 and the outputmodule 163 are a same display screen, and the storage module 164 is amemory, the wearable device in this embodiment of this application maybe a wearable device shown in FIG. 17.

As shown in FIG. 17, the wearable device includes a communicationsinterface 170, a processor 171, a memory 172, and a display screen 173.The communications interface 170, the processor 171, the memory 172, andthe display screen 173 are connected and communicate with each other byusing a system bus 174.

When the wearable device is running, the wearable device performs thefunction resource configuration method in the embodiment shown in FIG.3A and FIG. 3B, FIG. 4A and FIG. 4B, or FIG. 14. For a specific functionresource configuration method, refer to the foregoing relateddescriptions in the embodiment shown in FIG. 3A and FIG. 3B, FIG. 4A andFIG. 4B, or FIG. 14, and details are not described herein again.

The memory 172 may be configured to store a function resource list and afunction resource occupation list, and may be further configured tostore a software program and an application module. By running thesoftware program and the application module that are stored in thememory 172, the processor 171 performs various functional applicationsand data processing of the wearable device.

The memory 172 may mainly include a program storage area 1720 and a datastorage area 1721. The program storage area 1720 may store an operatingsystem, and an application required by at least one function, forexample, a program for detecting a state of a first function resource.The data storage area 1721 may store the function resource list, thefunction resource occupation list, and a function resource. In animplementation of this application, the operating system may be anAndroid (Android) system, an iOS system, or a Windows operating system,or may be an embedded operating system such as VxWorks.

In a specific implementation of this application, the memory 172 mayinclude a volatile memory, such as an NVRAM (Nonvolatile Random AccessMemory, nonvolatile dynamic random access memory), a PRAM (Phase ChangeRAM, phase change random access memory), or an MRAM (Magnetic RandomAccess Memory, magnetoresistive random access memory); or the memory 172may include a nonvolatile memory, such as at least one magnetic diskstorage device, an EEPROM (Electrically Erasable Programmable Read-OnlyMemory, electrically erasable programmable read-only memory), or a flashmemory such as a NOR flash memory (NOR flash memory) or a NAND flashmemory (NAND flash memory). The nonvolatile memory stores an operatingsystem and an application that are executed by the processor 171. Theprocessor 171 loads a running program and data from the nonvolatilememory to a memory and stores data content in a large quantity ofstorage apparatuses.

The memory 172 may independently exist, and is connected to theprocessor 171 by using the system bus 174. The memory 172 mayalternatively be integrated with the processor 171.

The processor 171 is a control center of the wearable device. Theprocessor 171 is connected to various parts of the entire wearabledevice by using various interfaces and lines. By running or executingthe software program and/or the application module stored in the memory172, and invoking data stored in the memory 172, the processor 171performs various functions and data processing of the wearable device,thereby performing overall monitoring on the wearable device.

The processor 171 may include only the CPU, or may be a combination ofthe CPU, a GPU (Graphic Processing Unit, graphics processing unit), theDSP, and a control chip (such as a baseband chip) in a communicationsunit. In this implementation of this application, the CPU may include asingle operation core, or may include a plurality of operation cores. Ina specific implementation, in an embodiment, the processor 171 mayinclude one or more CPUs. For example, the processor 171 in FIG. 17includes a CPU 0 and a CPU 1.

The system bus 174 may be an ISA (Industry Standard Architecture,industry standard architecture) bus, a PCI (Peripheral ComponentInterconnect, peripheral component interconnect) bus, an EISA (ExtendedIndustry Standard Architecture, extended industry standard architecture)bus, or the like. The system bus 174 may be classified into an addressbus, a data bus, a control bus, and the like. In this embodiment of thisapplication, for a purpose of clear description, all buses are marked asthe system bus 174 in FIG. 17.

Further, the wearable device may further include a power supply 175,configured to supply power to different components of the wearabledevice to maintain running of the components. It is generally understoodthat the power supply 175 may be a built-in battery such as a commonlithium-ion battery or a nickel-hydride battery; or may include anexternal power supply, such as an AC (Alternating Current, alternatingcurrent) adapter, that directly supplies power to the wearable device.In some implementations of this application, the power supply 175 mayalternatively have a broader definition, for example, may also include apower management system, a charging system, a power fault detectioncircuit, a power converter or inverter, a power status indicator (suchas a light emitting diode), and any other component related to powergeneration, management, and distribution of the wearable device.

It should be noted that the wearable device may further include awearing apparatus for wearing the wearing device by a user. For example,a smartband includes a wrist strap.

Correspondingly, another embodiment of this application further providesa computer-readable storage medium. The computer-readable storage mediumincludes one or more pieces of program code. The one or more programsinclude an instruction. When a processor of a wearable device performsthe program code, the wearable device performs the function resourceconfiguration method shown in FIG. 3A and FIG. 3B, FIG. 4A and FIG. 4B,or FIG. 14.

In this embodiment of this application, the wearable device includes atleast one function resource. For a first function resource in the atleast one function resource, even if the first function resource isalready occupied by a second terminal, after receiving a distributionrequest sent by a first terminal, the wearable device also determines,based on the distribution request received by the wearable device,whether to allow the first terminal to use the first function resource.If the wearable device allows the first terminal to use the firstfunction resource, the wearable device sends a notification message tothe first terminal, to instruct the first terminal to use the firstfunction resource. In this way, in a scenario in which the firstfunction resource is already occupied by the second terminal, the firstterminal may also use the first function resource.

An embodiment of this application provides a terminal. The terminal isconfigured to perform the steps performed by the terminal in theforegoing function resource configuration method. The terminal providedin this embodiment of this application may include modules correspondingto corresponding steps.

In this embodiment of this application, functional modules of theterminal may be divided based on the foregoing method examples. Forexample, functional modules may be divided based on functions, or two ormore functions may be integrated into one processing module. Theintegrated module may be implemented in a form of hardware, or may beimplemented in a form of a software functional module. In thisembodiment of this application, the module division is an example, andis merely logical function division, and there may be other divisionmanners in actual implementation.

When the functional modules are divided based on the functions, FIG. 18is a schematic diagram of a possible structure of the terminal in theforegoing embodiments. As shown in FIG. 18, the terminal includes adetermining unit 180, a sending unit 181, a receiving unit 182, adisplay unit 183, and a function implementation unit 184. Thedetermining unit 180 is configured to support the terminal to performS302 in FIG. 3A and FIG. 3B; the sending unit 181 is configured tosupport the terminal to perform S301 and S308 in FIG. 3A and FIG. 3B;the receiving unit 182 is configured to support the terminal to performS304, S307, S310, and S313 in FIG. 3A and FIG. 3B; the display unit 183is configured to support the terminal to perform S315 in FIG. 3A andFIG. 3B; and the function implementation unit 184 is configured tosupport the terminal to perform S311 in FIG. 3A and FIG. 3B. Forfunction descriptions of the corresponding functional modules, refer toall related content of the steps in the foregoing method embodiments,and details are not described herein again.

When an integrated unit is used. FIG. 19 is a schematic diagram of apossible structure of the terminal in the foregoing embodiments. Asshown in FIG. 19, the terminal includes a processing module 190 and acommunications module 191. The processing module 190 is configured tocontrol and manage an action of the terminal. For example, theprocessing module 190 is configured to support the terminal to performS302, S311, and S315 in FIG. 3A and FIG. 3B, and/or applied to anotherprocess of the technology described in this specification. Thecommunications module 191 is configured to support communication betweenthe terminal and another terminal. For example, the communicationsmodule 191 is configured to support the terminal to perform S301, S304,S307, S308, S310, and S315 in FIG. 3A and FIG. 3B.

In this embodiment of this application, the processing module 190 may bea processor or a controller, for example, a CPU or a DSP. The processingmodule 190 can implement or perform various examples of logical blocks,modules, and circuits described with reference to content disclosed inthis application.

In this embodiment of this application, the communications module 191may be a Bluetooth module configured to exchange data with an externaldevice, or may be a communications interface configured to exchange datawith an external device, or may be a transceiver, a transceiver circuit,or the like.

Similar to the wearable device, in this embodiment of this application,the communications module 191 may also include two communicationsinterfaces: a sending interface configured to send data to the externaldevice and a receiving interface configured to receive data from theexternal device, that is, the terminal may separately implementreceiving and sending of data by using two different communicationsinterfaces. Certainly, the communications module 191 may integrate adata receiving function and a data sending function on onecommunications interface, so that the communications interface has thedata receiving function and the data sending function. Thecommunications interface may be integrated on a Bluetooth chip or an NFCchip.

Optionally, the terminal may further include some input modules 192 andoutput modules 193 that are configured to implement interaction betweena user and the terminal. For structures of the input module 192 and theoutput module 193, refer to corresponding parts in FIG. 16, and detailsare not described herein again.

Optionally, in this embodiment of this application, the terminal furtherincludes a storage module 194, configured to store an operating systemand an application.

The storage module 194 may be a memory.

When the processing module 190 is a processor, the communications module191 is a communications interface, the input module 192 and the outputmodule 193 are a same display screen, and the storage module 194 is amemory, the terminal in this embodiment of this application may be theterminal shown in FIG. 20.

As shown in FIG. 20, the terminal includes a communications interface200, a processor 201, a memory 202, and a display screen 203. Thecommunications interface 200, the processor 201, the memory 202, and thedisplay screen 203 are connected and communicate with each other byusing a system bus 204. For hardware structures of the communicationsinterface 200, the processor 201, the memory 202, the display screen203, the system bus 204, and a power supply 205, refer to correspondingparts in FIG. 17, and details are not described herein again.

When the terminal is running, the terminal performs the functionresource configuration method in the embodiment shown in FIG. 3A andFIG. 3B, FIG. 4A and FIG. 4B, or FIG. 14. For a specific functionresource configuration method, refer to the foregoing relateddescriptions in the embodiment shown in FIG. 3A and FIG. 3B, FIG. 4A andFIG. 4B, or FIG. 14, and details are not described herein again.

Correspondingly, another embodiment of this application further providesa computer-readable storage medium. The computer-readable storage mediumincludes one or more pieces of program code. The one or more programsinclude an instruction. When a processor of a terminal performs theprogram code, the terminal performs the function resource configurationmethod shown in FIG. 3A and FIG. 3B.

In this embodiment of this application, after determining that a firstfunction resource is already occupied by another terminal, the terminalsends a distribution request to a wearable device, to request thewearable device to distribute a first function resource to the terminal.Correspondingly, the terminal may receive a notification message that issent by the wearable device and that is used to indicate that thewearable device allows the terminal to use the first function resource.The terminal uses the first function resource based on the notificationmessage received by the terminal. In this way, in a scenario in whichthe first function resource is already occupied by the another terminal,the terminal may also use the first function resource.

It may be clearly understood by a person skilled in the art that, forthe purpose of convenient and brief description, division of theforegoing functional modules is merely used as an example fordescription. In an actual application, the foregoing functions may bedistributed to different functional modules and implemented based on arequirement, that is, an inner structure of a mobile device is dividedinto different functional modules to implement all or some of thefunctions described above. For a detailed working process of theforegoing system, mobile device, and units, refer to a correspondingprocess in the foregoing method embodiments, and details are notdescribed herein again.

In the several embodiments provided in this application, it should beunderstood that the disclosed system, mobile device, and method may beimplemented in other manners. For example, the described mobile deviceembodiment is merely an example. For example, the module or unitdivision is merely logical function division and may be other divisionsin actual implementations. For example, a plurality of units orcomponents may be combined or integrated into another system, or somefeatures may be ignored or not performed. In addition, the shown ordiscussed mutual couplings or direct couplings or communicationconnections may be implemented through some interfaces. The indirectcouplings or communication connections between mobile devices or unitsmay be implemented in electrical, mechanical, or other forms.

The units described as separate parts may or may not be physicallyseparated, and parts shown as units may or may not be physical units,may be located in one position, or may be distributed on a plurality ofnetwork units. Some or all of the units may be selected based on actualrequirements to achieve the objectives of the solutions of theembodiments.

In addition, functional units in the embodiments of this application maybe integrated into one processing unit, or each of the units may existalone physically, or two or more units may be integrated into one unit.The integrated unit may be implemented in a form of hardware, or may beimplemented in a form of a software functional unit.

When the integrated unit is implemented in the form of a softwarefunctional unit and sold or used as an independent product, theintegrated unit may be stored in a computer-readable storage medium.Based on such an understanding, the technical solutions of thisapplication essentially, or the part contributing to the prior art, orall or some of the technical solutions may be implemented in a form of asoftware product. The computer software product is stored in a storagemedium and includes several instructions for instructing a computerdevice (which may be a personal computer, a server, a network device, orthe like) or a processor (processor) to perform all or some of the stepsof the methods described in the embodiments of this application. Thestorage medium includes: any medium that can store program code, such asa USB flash drive (Universal Serial Bus flash disk, Universal Serial Busflash drive), a removable hard disk, a ROM, a RAM, a magnetic disk, oran optical disc.

The foregoing descriptions are merely specific implementations of thisapplication, but are not intended to limit the protection scope of thisapplication. Any variation or replacement readily figured out by aperson skilled in the art within the technical scope disclosed in thisapplication shall fall within the protection scope of this application.Therefore, the protection scope of this application shall be subject tothe protection scope of the claims.

1.-45. (canceled)
 46. A function resource configuration method,implemented by a wearable device, the function resource configurationmethod comprising: receiving, by the wearable device, a distributionrequest from a first terminal, wherein the distribution request requeststhe wearable device to distribute a first function resource of thewearable device to the first terminal, and wherein the first functionresource is already occupied by a second terminal; determining, by thewearable device based on the distribution request, whether to allow thefirst terminal to use the first function resource; and sending, by thewearable device, a notification message to the first terminal toinstruct the first terminal to use the first function resource when thefirst terminal is allowed to use the first function resource.
 47. Thefunction resource configuration method of claim 46, wherein afterreceiving the distribution request, the function resource configurationmethod further comprises: presenting, by the wearable device, contentcorresponding to the distribution request to a user; and receiving, bythe wearable device, an instruction from the user, and whereindetermining whether to allow the first terminal to use the firstfunction resource comprises: allowing, by the wearable device, the firstterminal to use the first function resource in response to the wearabledevice receiving a first instruction from the user, wherein the firstinstruction instructs to distribute the first function resource to thefirst terminal; and forbidding, by the wearable device, the firstterminal to use the first function resource in response to the wearabledevice receiving a second instruction from the user, wherein the secondinstruction indicates that distribution of the first function resourceto the first terminal is forbidden.
 48. The function resourceconfiguration method of claim 46, wherein determining whether to allowthe first terminal to use the first function resource comprises:determining, by the wearable device based on the distribution request,whether an occupation duration is greater than a preset threshold,wherein the occupation duration is a time in which the second terminaloccupies the first function resource; allowing, by the wearable device,the first terminal to occupy the first function resource in response tothe determining that the occupation duration is greater than or equal tothe preset threshold; and forbidding, by the wearable device, the firstterminal to occupy the first function resource in response to thedetermining that the occupation duration is less than the presetthreshold.
 49. The function resource configuration method of claim 46,wherein determining whether to allow the first terminal to use the firstfunction resource comprises: determining, by the wearable device basedon the distribution request, whether a priority of the first terminal ishigher than a priority of the second terminal; allowing, by the wearabledevice, the first terminal to use the first function resource inresponse to the determining that the priority of the first terminal ishigher than the priority of the second terminal; and forbidding, by thewearable device, the first terminal to use the first function resourcein response to the determining that the priority of the first terminalis lower than the priority of the second terminal.
 50. The functionresource configuration method of claim 46, wherein before receiving thedistribution request, the function resource configuration method furthercomprises determining, by the wearable device, that the first functionresource is already occupied by the second terminal, and whereindetermining that the first function resource is already occupied by thesecond terminal comprises: receiving, by the wearable device, a statequery request from the first terminal, wherein the state query requestrequests to query a state of the first function resource; anddetermining, by the wearable device based on the state of the firstfunction resource, that the first function resource is already occupiedby the second terminal.
 51. The function resource configuration methodof claim 50, wherein after determining that the first function resourceis already occupied by the second terminal, the function resourceconfiguration method further comprises sending, by the wearable device,a state query response carrying a first state identifier to the firstterminal, and wherein the first state identifier indicates that thefirst function resource is already occupied by the second terminal. 52.The function resource configuration method of claim 50, wherein afterreceiving the state query request, the function resource configurationmethod further comprises: determining, by the wearable device based onthe state of the first function resource, that the first functionresource is not occupied by any terminal; and sending, by the wearabledevice, a state query response carrying a second state identifier to thefirst terminal, wherein the second state identifier indicates that thefirst function resource is not occupied by any terminal.
 53. Thefunction resource configuration method of claim 50, wherein afterreceiving the state query request, the function resource configurationmethod further comprises: determining, by the wearable device based onthe state of the first function resource, that the first functionresource is already occupied by the first terminal; and sending, by thewearable device, a state query response carrying a third stateidentifier to the first terminal, wherein the third state identifierindicates that the first function resource is already occupied by thefirst terminal.
 54. The function resource configuration method of claim46, wherein after receiving the distribution request and beforedetermining whether to allow the first terminal to use the firstfunction resource, the function resource configuration method furthercomprises determining, by the wearable device based on the distributionrequest, that the first function resource is already occupied by thesecond terminal.
 55. A function resource configuration method,implemented by a first terminal, the function resource configurationmethod comprising: determining, by the first terminal, that a firstfunction resource in a wearable device is already occupied by a secondterminal; sending, by the first terminal, a distribution request to thewearable device, wherein the distribution request requests the wearabledevice to distribute the first function resource to the first terminal;and receiving, by the first terminal, a notification message from thewearable device, wherein the notification message instructs the firstterminal to use the first function resource.
 56. The function resourceconfiguration method of claim 55, wherein before determining that thefirst function resource is already occupied by the second terminal, thefunction resource configuration method further comprises sending, by thefirst terminal, a state query request to the wearable device, andwherein the state query request requests to obtain a state of the firstfunction resource.
 57. The function resource configuration method ofclaim 56, wherein after sending the state query request to the wearabledevice, the function resource configuration method further comprisesreceiving, by the first terminal, a state query response carrying asecond state identifier from the wearable device, and wherein the secondstate identifier indicates that the first function resource is notoccupied by any terminal.
 58. The function resource configuration methodof claim 56, wherein after sending the state query request to thewearable device, the function resource configuration method furthercomprises: receiving, by the first terminal, a state query responsecarrying a third state identifier from the wearable device, wherein thethird state identifier indicates that the first function resource isalready occupied by the first terminal, and start using, by the firstterminal, the first function resource based on the third stateidentifier.
 59. The function resource configuration method of claim 55,wherein determining that the first function resource is already occupiedby the second terminal comprises: receiving, by the first terminal, astate query response carrying a first state identifier from the wearabledevice, wherein the first state identifier indicates that the firstfunction resource is already occupied by the second terminal; anddetermining, by the first terminal based on the first state identifier,that the first function resource is already occupied by the secondterminal.
 60. The function resource configuration method of claim 59,wherein after determining that the first function resource is alreadyoccupied by the second terminal, the function resource configurationmethod further comprises: presenting, by the first terminal, contentcorresponding to the state query response to a user; and receiving, bythe first terminal, a first instruction from the user, wherein the firstinstruction instructs the first terminal to request from the wearabledevice to distribute the first function resource to the first terminal.61. A wearable device, comprising: a memory; a communications interfacecoupled to the memory; and a processor coupled to the memory and thecommunications interface and configured to: receive, using thecommunications interface, a distribution request from a first terminal,wherein the distribution request requests the wearable device todistribute a first function resource stored in the memory to the firstterminal, and wherein the first function resource is already occupied bya second terminal; determine, based on the distribution request, whetherto allow the first terminal to use the first function resource; andsend, using the communications interface, a notification message to thefirst terminal instructing the first terminal to use the first functionresource when the first terminal is allowed to use the first functionresource.
 62. The wearable device of claim 61, further comprising adisplay screen coupled to the processor, wherein after the processorreceives the distribution request, the display screen is configured to:present content corresponding to the distribution request to a user; andreceive an instruction from the user, and wherein the processor isfurther configured to: allow the first terminal to use the firstfunction resource when the display screen receives a first instructionfrom the user, wherein the first instruction instructs to distribute thefirst function resource to the first terminal; and forbid the firstterminal to use the first function resource when the display screenreceives a second instruction from the user, wherein the secondinstruction indicates that distribution of the first function resourceto the first terminal is forbidden.
 63. The wearable device of claim 61,wherein the processor is further configured to: determine, based on thedistribution request, whether an occupation duration is greater than apreset threshold, wherein the occupation duration is a time in which thesecond terminal occupies the first function resource; allow the firstterminal to occupy the first function resource when the occupationduration is greater than or equal to the preset threshold; and forbidthe first terminal to occupy the first function resource when theoccupation duration is less than the preset threshold.
 64. The wearabledevice of claim 61, wherein the processor is further configured to:determine, based on the distribution request, whether a priority of thefirst terminal is higher than a priority of the second terminal; allowthe first terminal to use the first function resource when the priorityof the first terminal is higher than the priority of the secondterminal; and forbid the first terminal to use the first functionresource when the priority of the first terminal is lower than thepriority of the second terminal.
 65. The wearable device of claim 61,wherein before receiving the distribution request, the processor isfurther configured to: receive, using the communications interface, astate query request from the first terminal, wherein the state queryrequest requests to query a state of the first function resource; querythe state of the first function resource; and determine, based on thestate of the first function resource, that the first function resourceis already occupied by the second terminal.